Solved

IllegalStateException when response.redirect a jsp page from servlet

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
strCount chalenge 3 81
json format text only 4 83
word0 challenge 4 68
login form jsp example 2 25
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 …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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.

777 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