Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

about requestdispatcher

 
Tang Yue
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the doGet() of FirstServlet:
PrintWriter out = response.getWriter();
out.println("<html><body>Page 1");
RequestDispatcher rd = request.getRequestDispatcher("NextServlet");
rd.forward(request, response);
out.println("<br>Page 3</body></html>");



will this generate an IllegalStateException because of the "out.printtln" after "rd.forward"
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's not that statement that will cause illegalStateException. If in your line 3 above, the response was commited, the exception will be generated when you try to do the forward.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic