• Post Reply Bookmark Topic Watch Topic
  • New Topic

about requestdispatcher  RSS feed

 
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: 1512
  • 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
Boost this thread!