Solved

IllegalStateException when response.redirect a jsp page from servlet

Posted on 2008-10-16
1
998 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
bigHeights  challenge 13 60
userCompare  challenge 3 68
diffSum example 4 24
table example 4 23
I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
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.

910 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now