Ah, good deal. Not only did I not realise it was in an included page (for
some reason, the relevance just didn't sink in), but I didn't know that
about the spec, partly because I've not tried to include pages that
redirect, so had no need to know. :) Good call, Hans.


>From: Jay Burgess <[EMAIL PROTECTED]>
>Reply-To: A mailing list about Java Server Pages specification and
>reference <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Re: sendRedirect() from within a <jsp:include>?
>Date: Mon, 20 May 2002 13:26:05 -0500
>
>Thank you!  Your explanation about setting headers is exactly what I was
>running up against.  I went back to the spec, and section JSP.4.4 calls it
>out very clearly:
>
>"An included page only has access to the JspWriter object and it cannot set
>headers. This precludes invoking methods like setCookie(). Attempts to
>invoke these methods will be ignored."
>
>In my attempt to find other reasons for my problem, I missed this very
>obvious cause.  I'll have to look now for another solution to the problem
>I'm trying to solve.
>
>Thanks again.
>
>Jay
>
> > -----Original Message-----
> > From: Hans Bergsten [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, May 20, 2002 11:53 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: sendRedirect() from within a <jsp:include>?
> >
> >
> > Sorry if I'm missing something, but I believe this thread started with
> > a quetsion about why <jsp:include> of a page that does a redirect
> > doesn't cause the request to be redirected. The answer to this is that
> > an included page (using <jsp:include> or pageContext.include()) is not
> > allowed to set headers. If it does, the headers are silently ignored.
> > The include mechanism is only for including the body content produced
> > by the included page.
> >
> > If you want to redirect from a JSP page, use this code in the
> > main page:
> >
> >    response.sendRedirect("nextPage.jsp");
> >
> > either in a scriptlet or in a simple custom action.
> >
> > Hans



_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to