Can anyone tell me how to get the managed bean property value inside the javascript method
something like
function fonction1() {
var variable = "#{myBean.property}";
}
Can anyone tell me how to get the managed bean property value inside the javascript method
something like
function fonction1() {
var variable = "#{myBean.property}";
}
You can like this:
<h:inputText id="propertyId" value="#{myBean.property}" style="display:none"/>
and access it like this (note that if its inside a form you might need to add the form prefix)
alert($('#propertyId').val()); // or alert($('#myFormId\\:propertyId').val());
I guess you want it to be updated to the current value inside the bean. You can't! You can only add it to javascript during load time. If you want it to be updated you will have to do ajax calls to fetch the current value.