• Post Reply Bookmark Topic Watch Topic
  • New Topic

Servlet forwarding  RSS feed

 
Ravi Singh
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After forwarding control to another JSP page or servlet using the RequestDispatcher.forward() method, can the response be modified once the forward method returns? For example,

RequestDispatcher rd = request.getRequestDispatcher("/somepath");
rd.forward(request, response);

response.getWriter().println("Some more output");
 
D K Singh
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No you can't. If you try it should throw IllegalStateException.
 
Ravi Singh
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does control return to the original forwarding servlet after the forward operation?
 
Ramakrishnan thiyagarajan
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
forward source is Responsible issuing the response.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66152
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does control return to the original forwarding servlet after the forward operation?


Why not write some code and see?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!