title: How to reload a JSP with request.getAttribute values
body: <p>I have this application where i want to populate a text file on the basis of entries entered from user interface. 
  I chose Struts1 for this and i have been able to complete most of the functionalities.But the part of keeping on populating the 
  text file on the basis of user entries in my JSP is something i am struggling with. The following are the flow of pages on user interface </p>
  
  <p>1.'Accept user entries' <a href="http://www.image-share.com/ijpg-1178-104.html" rel="nofollow">http://www.image-share.com/ijpg-1178-104.html</a> 
  2.'Ask for scan data on the basis of entries in page1' <a href="http://www.image-share.com/ijpg-1178-105.html" rel="nofollow">http://www.image-share.com/ijpg-1178-105.html</a> 
  3.'Submit after entering the scandata. ' <a href="http://www.image-share.com/ijpg-1178-106.html" rel="nofollow">http://www.image-share.com/ijpg-1178-106.html</a> 
  (I have been able to straighten the null values in the images via session variables. Thanks to Dave) 
  message is seen with null entries like this Post validation. 
  My questions is: 
   What should be used so that there is a scenario that the users enter the Scan Data on page 2 and can continue to enter 
  more scan data values by falling back on the same JSP . I was thinking on the lines of reloading the page using JavaScript 
  on the button click. Is it the right approach? </p>
  
  <p>The relevant code for this is </p>
  
  <pre><code> &lt;html:form action="txtwriter"&gt;    
    &lt;% String itemname = (String)session.getAttribute("itemname");   %&gt; 
   &lt;% String lotnumber = (String)session.getAttribute("lotnumber");   %&gt;
   &lt;% String godownname = (String)session.getAttribute("godownname");  %&gt; 
   &lt;br/&gt;  
   &lt;% String message = (String)session.getAttribute("message");    
   session.setAttribute( "theFileName", message );  %&gt;  
    Filename : &lt;%= message %&gt;  
   &lt;br/&gt;  Item Name :&lt;%= itemname %&gt;
    &lt;br/&gt; Lot Number :&lt;%= lotnumber %&gt; 
     &lt;br/&gt;    Godown Name :&lt;%= godownname %&gt;  
   &lt;br/&gt;    &lt;bean:message key="label.scandata"/&gt; 
   &lt;html:text property="scanData" &gt;&lt;/html:text&gt;    
   &lt;html:errors property="scanData"/&gt; 
   &lt;br/&gt;     
  &lt;html:submit/&gt; 
    /* How should the submit button handle the onClick event so that when the users click  
    after entering the text.
   1. The entered text must be populated in the text file using a different action class.  (I have    this part working) 
    2.They must be on the same jsp with the scanData text box cleared waiting for the next  user      entry into that text 
   box so that this subsequest entry can also be entered into the text file. 
   Is there a way i can empty the 'scanData' textbox by accessing it by name inside my action so that i can empty it from my action class?
   (I am looking for this     answer)
  </code></pre>
  
  <p>*/<br>
      <br/><br>
       </p>
  
  <p>I used this inside the LoginAction.java</p>
  
  <pre><code>HttpSession session = request.getSession();   
  session.setAttribute("message", textFile);   
  session.setAttribute("itemname",loginForm.getItemName().trim());   
  session.setAttribute("lotnumber",loginForm.getLotNumber().trim());    
  session.setAttribute("godownname",loginForm.getStockGodown().trim());    
  </code></pre>