File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes IllegalStateException in forward Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "IllegalStateException in forward" Watch "IllegalStateException in forward" New topic
Author

IllegalStateException in forward

Ronaldo Luiz
Greenhorn

Joined: Oct 26, 2005
Posts: 2
I was trying to test the example of this tutorial: WTP Tutorials - Building a School Schedule Web Application.
This exception has been throwed when trying to execute the forward below.
java.lang.IllegalStateException: Cannot forward after response has been committed

getServletContext().getRequestDispatcher("/Schedule.jsp").forward(request, response);

William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
java.lang.IllegalStateException: Cannot forward after response has been committed

That means what it says - something flushed the response output buffer - I suspect the code:

What is that in there for/
Bill
Ronaldo Luiz
Greenhorn

Joined: Oct 26, 2005
Posts: 2
Ok, I removed this and the problem was resolved.
The strange thing is that when I run the eclipse wizard to override a method, the wizard put this line automatically.
Paul Bourdeaux
Ranch Hand

Joined: May 24, 2004
Posts: 783
Ah, the power of a smart IDE and its ability to break a simple program...

I am not an Eclipse expert, but most "smart" IDEs have a place where you can modify the templates and remove the call to super...

Personally, I hate using wizards for problems just like that!


“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” - Rich Cook
sureshreddy puli
Greenhorn

Joined: Sep 28, 2005
Posts: 29
try to work on Eclipse IDE. It saves your valueable time.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: IllegalStateException in forward