You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Milan Duriancik <mi...@tempest.sk> on 2000/03/16 12:01:36 UTC

sendRedirect in a JSP page

Hello,

I repost my earlier question:

Is it leagal to call sendRedirect in a JSP page. (I need it for authorisation
purpouses)
When I do it I get  IllegalStateException.
Is it my fault or is it a bug?

                                                            Milan


--
----------------------
Milan Duriancik
Tempest s.r.o., Hanulova 5/B,
Bratislava, Slovakia
GSM: ++421 905 466 201
Work: ++421 7 69 25 41 24



Re: sendRedirect in a JSP page

Posted by "Craig R. McClanahan" <cm...@mytownnet.com>.
Milan Duriancik wrote:

> Hello,
>
> I repost my earlier question:
>
> Is it leagal to call sendRedirect in a JSP page. (I need it for authorisation
> purpouses)
> When I do it I get  IllegalStateException.
> Is it my fault or is it a bug?
>

It is not legal to call sendRedirect() in a JSP if the output has already been
"committed", meaning that the HTTP headers and the beginning of the current
output page has already been sent back to the client browser.  You can make it
work by doing one of the following:

* Move the call to sendRedirect() further up your
  page, so that it's encountered before the number
  of bytes specified by your buffer size have been
  accumulated.

* Change the buffer size in the <%@ page %>
  directive to a larger value.

Also, please start using the brand new TOMCAT-USERS@JAKARTA.APACHE.ORG mailing
list for usage questions like this.  The TOMCAT-DEV list is intended to support
discussion among those developing Tomcat itself.  Subscription information is at
the Jakarta web site <http://jakarta.apache.org>.

>
>                                                             Milan
>

Craig McClanahan