title: JSF 2 passing values to ManagedBean file on Checkbox Click event
body: <p>I Have the following code:</p>
  
  <pre><code>&lt;h:form id="formId"&gt;
      &lt;h:inputHidden id="x" value="#{userBean.x}" /&gt;
      &lt;h:inputHidden id="y" value="#{userBean.y}" /&gt;
      &lt;h:selectBooleanCheckbox event="click" listener="#{userBean.submit}" /&gt;
  &lt;/h:form&gt;
  &lt;script&gt;
      function getVars() {
          var x = 10; 
          var y = 20;
  
          document.getElementById("formId:x").value = x;
          document.getElementById("formId:y").value = y;
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>and the ManagedBean code goes as follows:</p>
  
  <pre><code>public class UserBean {
      public int x;
      public int y;
  
      public int getX() {
          return x;
      }
  
      public void setX(int x) {
          this.x = x;
      }
  
      public int getY() {
          return y;
      }
  
      public void setY(int y) {
          this.y = y;
      }
  
      public void submit() {
          System.out.println("x: " + x);
          System.out.println("y: " + y);
          // ...
      }
  </code></pre>
  
  <p>on the click event of checkbox I want the values of <code>x</code> &amp; <code>y</code> variables to be passed to the managed bean file. How to do that?</p>