Solved

IllegalStateException when response.redirect a jsp page from servlet

Posted on 2008-10-16
1
1,003 Views
Last Modified: 2013-11-24
Hi

I have a servlet when certain condition met, it will be redirected to another jsp page. It did work on localhost:8080, but it did not work when i deploy it on remote server with the same settings and jre


java.lang.IllegalStateException
org.apache.catalina.connector.ResponseFacade.sendRedirect(ResponseFacade.java:435)
com.mycompany.reg.doPost(Registratoin_Step4_Submit.java:122)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

Open in new window

0
Comment
Question by:techques
1 Comment
 
LVL 6

Accepted Solution

by:
javaexperto earned 50 total points
ID: 22736566
If you look up sendRedirect() in the API, you'll see that it throws an IllegalStateException if you try to invoke it after "the response has already been committed".
By "committed", they mean that the response has been sent. That just means the data has been flushed to the stream.
For practical purposes, it means you cant write to the response and then call sendRedirect()!

look at this in your servlet code or paste it here so I can help you.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
mockito example issue 8 81
hibernate jars 4 45
ejb example issues 3 18
SequenceInputStream example 3 19
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question