title: struts form and hidden field in javascript
body: <p>I have a form, and i do some calculation using java script (date object is just an example here). I need to use that dateVar in my jsp that the form is sumitted to. Can somebody please help me to get the proper implementation and also if there are any working examples of the same? </p>
  
  <pre><code>&lt;%@ page contentType="text/html;charset=UTF-8" language="java" %&gt;  
  &lt;%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %&gt;  
  &lt;%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %&gt;  
  &lt;html:html xhtml="true"&gt;  
      &lt;head&gt;  
          &lt;script type="text/javascript"&gt;     
              var dateVar = new Date();  
              document.write('&lt;input type="text" id="date" name="date" value=' + dateVar + "/&gt;");  
              document.write('&lt;html:text property="dateVar" value="' + dateVar + '" /&gt;');  
          &lt;/script&gt;  
      &lt;/head&gt;  
      &lt;body&gt;  
          &lt;html:form action="/submitForm"&gt;  
              &lt;bean:message key="prompt.clientId"/&gt;:  
              &lt;html:text property="clientId" size="16" maxlength="16"/&gt;  
              &lt;BR/&gt;  
              &lt;html:submit property="display"&gt;  
                  &lt;bean:message key="button.display"/&gt;  
              &lt;/html:submit&gt;  
              &lt;html:submit property="displayAll"&gt;  
                  &lt;bean:message key="button.displayAll"/&gt;  
              &lt;/html:submit&gt;  
              &lt;html:cancel&gt;  
                  &lt;bean:message key="button.cancel"/&gt;  
              &lt;/html:cancel&gt;  
          &lt;/html:form&gt;  
       &lt;/body&gt;  
  &lt;/html:html&gt;
  </code></pre>