title: Accessing a value in Struts ActionForm from JSP
body: <p>I am a Struts 1.3.10 newbie and I have an issue where I have an <code>Action</code> called <code>RegistrationAction</code> as follows:</p>
  
  <pre><code>    public final class RegistrationAction extends Action{
  
          @Override
          public ActionForward execute(ActionMapping mapping,
                                       ActionForm form,
                                       HttpServletRequest request,
                                       HttpServletResponse response)
          throws Exception{
  
             RegistrationForm formBean = (RegistrationForm) form;
             String userid = formBean.getUserid();
             String pwd = formBean.getPassword();
  </code></pre>
  
  <p>The userid and password are then saved to a <code>HashMap&lt;String, String&gt;</code> with attributes <code>_userid</code> and <code>pwd</code>.</p>
  
  <p><code>RegistrationAction</code> then calls a JSP if the validation of the <code>userid</code> and <code>password</code> are successful. But what I am finding is that in the JSP, the userid is not being displayed using the following code:</p>
  
  <pre><code>    &lt;h1&gt;Hello  &lt;bean:write name="RegistrationForm" property="_userid" /&gt;!&lt;/h1&gt;
  </code></pre>
  
  <p>The matching <code>ActionForm RegistrationForm</code> contains the <code>_userid</code> field as below:</p>
  
  <pre><code>    public final class RegistrationForm extends ActionForm{
  
          private String _userid = null;
  
          public String getUserid(){ return _userid; }
          public void   setUserid(String userid){ _userid = userid; }
  
          ...
  </code></pre>
  
  <p>I know that an instance of <code>RegistrationForm</code> is being populated because I can retrieve the entered <code>_userid</code> via:</p>
  
  <pre><code>    if(err == RegistrationModel.OK){
              System.out.println("Here " + model.getUserid()); 
  </code></pre>
  
  <p>I thought that a reference to the <code>RegistrationForm</code> in the JSP such as:</p>
  
  <p><code>&lt;h1&gt;Hello  &lt;bean:write name="RegistrationForm" property="_userid" /&gt;!&lt;/h1&gt;</code></p>
  
  <p>Would work. </p>
  
  <p>Can anyone suggest where I'm wrong?</p>
  
  <p>Thanks to the respondents. The page works now.</p>