how to get managed bean property value inside javascript

17,480

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());
Share:
17,480
Bob Samadi
Author by

Bob Samadi

Updated on July 30, 2022

Comments

  • Bob Samadi
    Bob Samadi over 1 year

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

    something like

    function fonction1() {
      var variable = "#{myBean.property}";
    }