Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Apache Tomcat »

Re: Servlet with POST Request

Hassan Schroeder

2006-12-15

Replies:

On 12/15/06, Scott Carr <scarr@(protected):
> Hm, the reason I asked, is because of a test I ran. strLine is always null.

Here's the simple test method I used:

  protected void doPost(HttpServletRequest request,
     HttpServletResponse response)
   throws ServletException, java.io.IOException
 {  
   BufferedReader reader = request.getReader();
   String line;
   while ( (line = reader.readLine()) != null )
   {
     System.out.println(line);  
   }
   
   RequestDispatcher rd =
this.getServletContext().getRequestDispatcher("/WEB-INF/jsp/screen/screen-post.jsp");
   rd.forward(request, response);    
 }
}

POSTed content is written to catalina.out as I'd expect.

--
Hassan Schroeder ------------------------ hassan.schroeder@(protected)

---------------------------------------------------------------------
To start a new topic, e-mail: users@(protected)
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.