On Tue, 27 Aug 2002, Greg Dunn wrote:
> You can also use:
>
> RequestDispatcher rd =
> getServletContext().getRequestDispatcher("/index.jsp");
>
> ... something something, code code, something ...
>
> rd.forward(request, response);
Don't know if that will help with the IllegalStateException (you can
get them with RequestDispatcher forward's as well as redirect's). I
believe those occur when you've done something with the response that
you shouldn't do (because it will be done wherever you
redirect/forward to) -- things like open the response output
stream/writer, set certain headers or content type or such -- check
the spec for details. Also not sure what would've changed about this
from servlet spec 2.2 (which Tomcat 3.X implements) to 2.3 (which 4.X
implements), but there are probably some things that did.
> -----Original Message-----
> From: A mailing list for discussion about Sun Microsystem's Java Servlet
> API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of
> Christopher Doyle
> Sent: Tuesday, August 27, 2002 2:19 PM
> To: [EMAIL PROTECTED]
> Subject: response.sendRedirect
>
>
> Hi all--
>
> I have this problem using the response.sendRedirect method. I've used the
> method and it works fine on Tomcat 3.2, but when I switched to Tomcat 4.0.4
> I started to receive IllegalStateException errors when my servlet tried to
> process the response.sendRedirect method. Has anyone else had similar
> problems? Or know of another way to call a JSP page from within a servlet
> (without rewriting the entire page)?
>
> response.sendRedirect(http://localhost:1964/BookNook/index.jsp);
>
> nor
>
> response.sendRedirect(http://localhost:1964/BookNook/index.jsp);
>
> seem to work anymore...
>
> Thanks
>
> Chris
> [EMAIL PROTECTED]
Milt Epstein
Research Programmer
Systems and Technology Services (STS)
Campus Information Technologies and Educational Services (CITES)
University of Illinois at Urbana-Champaign (UIUC)
[EMAIL PROTECTED]
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html