-
1. Re: a4j:jsfunction vs calling method directly from javascript
gurusathish Aug 21, 2015 6:39 AM (in response to developer112)Hi Reddy,
a4j:jsFunction has it's own specific functionalities. If you want to just a backing bean method to be called you can call like what you have posted. But if you want to display the updated content after the backing bean method is called, it is better to use the rich faces tag a4:jsFunction, because it has the function like render, onbegin, oncomplete,onbeforedomupdate.
Just For example (Not efficient logical vice)
public class userBean
{
private String userName;
public String getUserName()
{
return this.userName;
}
public void setUserName(String userName)
{
this.userName = userName;
}
}
public class ActionController(){
public string updateUserName(HttpRequest request)
{
String tempUserName = "NewUserName";
userBean.setUserName(tempUserName);
return page;
}
}
Assume that you want to update the password and want to display the updated password. Then you have to call the jsFunction
<a4j:jsFunction name="updateUserName" action="#{actionController.updateUserName}" render="passPopupPanel" limitRender="true" execute="@this"
oncomplete="#{rich:component('passPopupPanel').show()}"/> (tag according to richfaces 4)
passPopupPanel is rich:popupPanel which shows the updated password
This is the use of the a4j:jsFunctionThanks