Bookmark Topic Watch Topic
  • New Topic

JSP forward help

 
Ravi Singh
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • 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");
%>
[ August 16, 2004: Message edited by: Bear Bibeault ]
 
Stan Sokolov
Ranch Hand
Posts: 120
Hibernate IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Report post to moderator
Not sure. Regarding this. But in any case you can use filter. Filter is a class that get access on the each ouput response before it should be sent to the client. So whenever request is fullfilied it comes to the filter and it can add or remove some attributes. If some redirection was performed during the request fullfillment it does not make any effect on the filter logic.
http://www.javaworld.com/javaworld/jw-06-2001/jw-0622-filters.html
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65516
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
"Mr Singh",

We're pleased to have you here with us on the Ranch, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
Forum Bartender
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65516
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
With regards to your question, what happened when you tried it?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65516
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
also, please do not cross-post the same question in multiple forums. It wastes people's time when multiple redundant conversations take place. Please continue any discussion of this topic here.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!