Solved

IllegalStateException when response.redirect a jsp page from servlet

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Spring Boot Security, adding filters to different routes 2 68
nested interface 5 38
strCount chalenge 3 50
firstChar challenge 13 84
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 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…
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.

757 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