Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

sendRedirect from jsp:include

 
Kem Broderick
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm trying to use a sendRedirect in a jsp that I've
included in another using jsp:include. This doesn't
seem to work, is it possible or is it a limitation.
example:
+-------+
|JSP01 |
|+-----+|
| |JSP02| | +-----+
| | +---->| |
| | | | |JSP03|
|+-----+| | |
+-------+ +-----+
don't know if this makes sense...
 
James Hobson
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
response.sendRedirect is "dangerous" as it commits the response -- meaning that you cant write to it any more.
Typically sendRedirect will give you IllegalStateExceptions, as even if you dont write to the JSPWriter, the Servlet made from your JSP will likely include out.println(/r/n) lines in odd places.
You should probably use jsp:forward
James
 
The moth suit and wings road is much more exciting than taxes. Or this tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!