Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get managed bean property value inside javascript [duplicate]

Can anyone tell me how to get the managed bean property value inside the javascript method

something like

function fonction1() {
  var variable = "#{myBean.property}";
} 
like image 383
Bob Samadi Avatar asked Jul 18 '26 14:07

Bob Samadi


1 Answers

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());
like image 98
Daniel Avatar answered Jul 20 '26 03:07

Daniel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!