title: Struts 1: Accessing form values with bean:write
body: <p>Greetings,</p>
  
  <p>This is a simple question I believe, but nonetheless it is stumping me right now.</p>
  
  <p>I have a TestForm class with your usual getters/setters...for example I have an "id" field with "getId" and "setId" methods.</p>
  
  <p>My form is populated in an action class correctly (which I know from stepping through the Eclipse debugger) just before it is sent to the jsp page which has the code below:</p>
  
  <pre><code>&lt;html:form action="/AppropriateAction"&gt;  
  &lt;bean:define id="testFormA" name="TestForm" type="com.whatever.form.TestForm" /&gt;
  
  form = &lt;bean:write name="testFormA" /&gt;##  
  id = &lt;bean:write name="testFormA" property="id" /&gt;##  
  
  &lt;/html:form&gt;  
  </code></pre>
  
  <p>My output looks like this:</p>
  
  <p>form = com.whatever.form.TestForm13a3x4##</p>
  
  <p>id = ##</p>
  
  <p>Now I know that the page can see the form correctly due to the first line of the output, but if this is the case then why does the id show that it is empty from this statement:</p>
  
  <pre><code>id = &lt;bean:write name="testFormA" property="id" /&gt;##  
  </code></pre>
  
  <p>What am I doing wrong to access the id field of my form on this jsp page?</p>
  
  <p>Many thanks!</p>