title: How to use form bean in jsp servlets
body: <p>HI I am not using any MVC .. But I would like to get the same functionality in my JSP Servlets application.</p>
  
  <p>I have jsp having some text fields of date, string, number..etc.. I have created a form bean class with the names of text fields in my jsp with getters and setters like below..</p>
  
  <p>JSP (Edited)</p>
  
  <pre><code>   &lt;form name="myForm" action="myAction" method="post"&gt;
  
        &lt;jsp:useBean id="jspBean" class="com.package.my.BeanClass" scope="request" /&gt;
         &lt;jsp:setProperty prperty="*" name="jspBean" /&gt;
      //Below some text fields and date fileds 
       &lt;table&gt;
         &lt;tr&gt;
            &lt;td&gt;
                 UserName :
             &lt;/td&gt;
             &lt;td&gt;
                 &lt;input type="text" value="${myBean.userName}" name="userName"/&gt;
            &lt;/td&gt;
  
          &lt;/tr&gt;
            &lt;td&gt;
                 PassWord :
             &lt;/td&gt;
             &lt;td&gt;
                 &lt;input type="text" value="${myBean.passWord}" name="passWord"/&gt;
            &lt;/td&gt;
  
          &lt;/tr&gt;
            &lt;td&gt;
                 Date : 
             &lt;/td&gt;
             &lt;td&gt;
                 &lt;input type="text" value="${myBean.date}" name="date"/&gt;
               // This text field is with JQUery Date picker
            &lt;/td&gt;
  
          &lt;/tr&gt;
          &lt;tr&gt;
           &lt;td&gt;
             &lt;input type="submit" value="login"  /&gt;
            &lt;/td
          &lt;/tr&gt;
       &lt;/table&gt;
     &lt;/form&gt;   
  </code></pre>
  
  <p>IN My servlet</p>
  
  <pre><code>   // I Can get those text fields as Parameters i.e
  
         req.getParameter("userName")
  
      //And I cant get that bean Object `jspBean`
      // I am trying to get that as below
        sysout(req.getAttribute("jspBean"));//It prints null   
  
       // So I create a plain bean object and I am setting the data here 
          MyBean bean = new MyBean();
           // bean.setUserName();
            // I am setting all these fields whaterver needed
          req.setAttribute("myBean",bean);  
  </code></pre>
  
  <p><strong>problem</strong></p>
  
  <p>1) I can get the bean object and its data from <code>Servlet</code> to <code>JSP</code> usinf <code>EL</code> I am able to do.. What I want is I want send form data(all fields) as BeanObject instead of Parameters.. That I am not able to acheive,</p>
  
  <p>How to achieve this.. Please help</p>
  
  <p>Thanks in advance./</p>