title: How to set value to a hidden property with a button?
body: <p>I have the following files:</p>
  
  <p>view.jsp</p>
  
  <pre><code>&lt;@ page import=...
  &lt;bean:define id="mForm" name="myForm" type="MyForm"/&gt;
  &lt;html:form action="MyFoo" method="post" styleId="myForm" enctype="multipart/form-data"&gt;
  &lt;html:hidden property="boo"/&gt;
  &lt;input type="button" value="Press me" onclick="javascript:changeBoo()"/&gt; 
  &lt;/html:form&gt;
  </code></pre>
  
  <p>MyForm.java</p>
  
  <pre><code>class MyForm {
      private boolean boo;
      public void setBoo(boolean boo){
          this.boo = boo;
      }
      public boolean getBoo(){
          return this.boo;
      }
  }
  </code></pre>
  
  <p>MyFooAction.java</p>
  
  <pre><code>public class MyFooAction extends BaseAction {
  
      public ActionForward execute(ActionMapping mapping, ActionForm form,
              HttpServletRequest request, HttpServletResponse response)
              throws Exception {
          ActionForward aForward = null;
          String forward = "success";
  
          try {
              MyForm myForm = (MyForm) form;
              String boo = (String)request.getParameter("boo");
              if(boo.equals("true")){
                  System.out.println("&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;DONE");
              }
              else {
                  //some code here
              }
              aForward = mapping.findForward(forward);
          }
          catch (Exception e) {
              throw new Exception();
          }
  
          return aForward;
      }
  }
  </code></pre>
  
  <p>The question is how to implement <code>changeBoo()</code> in Javascript in order to change the value of <code>boo</code> and to invoke <code>MyFooAction</code> with correct value of <code>boo</code>?</p>