Skip to main content
chakrri Reddy ha fatto una domanda in #Visualforce
Hi

came across the below statements while reading about the difference between Actionsupport and Actionfunction

1. Action function can call the controller method directly from java script.

2. Action support adds AJAX support to another visualforce component and then call the controller method.

  It makes sense to me that,

--ActionFunction works only with the help of javascript(that invokes controller method),but

--actionupports does not need any javascript to call the controller method

--Actionfunc can be used for popup message etc,which cant be done by Actionsupport

--We can use one controller method for multiple Actionfunction components on a vf page

     Are my above conclusions right till here or please correct me if i am wrong.

 

I wonder what is meant by adding ajax request to another component in Action support statement. I mean

For exanple...we can use command button for both actionSup and ActionFuc and onclick of those buttons action will be performed as (render rerender renderas etc),so here buttons are components then where is another component here, and both are doing same things almost, besides actionFunc is also working on Onclik basis even though without having such event in the syntax.

 

lastly, if i have two command buttons with same name "Save" at different places on my vf page and required to define Actionsupport for them,do i have to create seperate methods for those two buttons or can i use one method for those two buttons

 
2 risposte
  1. 25 lug 2015, 19:21
    They are similar in many ways.

    The main difference is:

    Actionfunction is a function that can be called by any component via onclick, ondbclick, onblur event of that component

    ActionSupport is added to a particular component like button or outputtext and the event is controlled by the actionsupport not the component thus actionsupport help enhance the compononment itself by being part of the component itself.

    "lastly, if i have two command buttons with same name "Save" at different places on my vf page and required to define Actionsupport for them,do i have to create seperate methods for those two buttons or can i use one method for those two buttons"

    Each button would need it's own action support tag but both action supports can call the same method in the controller like action="{!Save}"

    Here's a good article for the differences:

    http://www.cloudforce4u.com/2013/06/difference-between-action-support-and.html

    Thx

    Good Luck
0/9000