You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Sergey Karpunichev <ka...@hotmail.com> on 2000/03/30 20:03:31 UTC
About redirecting after inclusion
Hi,
Example, shown below works fine with jswdk 1.1 and returns error "Included
servlet error: 200" with Tomcat 3.1
Error occurs when I try to start with page 1.jsp
Thanks in advance,
Sergey
1.jsp: *************
<html>
<body>
<jsp:include page="2.jsp" flush="true"/>
</body>
</html>
2.jsp: *************
<html>
<body>
<%
do some work here
...
response.sendRedirect("3.jsp");
%>
</body>
</html>
3.jsp: ************
<hr>
TEXT
<hr>
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
Re: About redirecting after inclusion
Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
The 'flush="true"' attribute on the <jsp:include> tells Tomcat to commit the
response, which causes (among other things) the HTTP headers to be sent back
to the client. Once this happens, you can no longer do a sendRedirect()
because that would require modifying the headers.
So, the short answer is you cannot do a sendRedirect() -- or anything else
that implies modifying the HTTP headers, such as trying to add a cookie --
from within an included JSP page.
Craig McClanahan
Sergey Karpunichev wrote:
> Hi,
>
> Example, shown below works fine with jswdk 1.1 and returns error "Included
> servlet error: 200" with Tomcat 3.1
> Error occurs when I try to start with page 1.jsp
>
> Thanks in advance,
> Sergey
>
> 1.jsp: *************
> <html>
> <body>
> <jsp:include page="2.jsp" flush="true"/>
> </body>
> </html>
>
> 2.jsp: *************
> <html>
> <body>
> <%
> do some work here
> ...
> response.sendRedirect("3.jsp");
> %>
> </body>
> </html>
>
> 3.jsp: ************
> <hr>
> TEXT
> <hr>
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org