Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

sendRedirect from jsp:include  RSS feed

 
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!