we wonder that if it is possible to get managed bean property value inside the javascript method in facelets or pass a javascript value to managed bean property but without
You can create a json object with name value pair like in a map and send them as a request parameters. You can have a p:remoteCommand
which could be called from your javascript function like below
function sendParams() {
passToJSFManagedBean ([ {
name : 'sno',
value : 1
},
{
name : 'name',
value : srikanth
}
]);
}
The above passToJSFManagedBean
should be a name of a remote command function like below
<p:remoteCommand name="passToJSFManagedBean" id="passToJSFManagedBeancmd"
action="#{myBean.getParams}"
process="@this" />
You can access the params passed in your managed bean action
public void getParams() {
String sno= FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap()
.get("sno");
//same way you can get name
}
Hope this helps