Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Response already Committed

 
Jailani Sahul Hameed
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
In our application we are using servlets to communicating over the screens .I am getting Response already Committed error once in a while while accessing our applications
Give me some idea what will be the cause to get this error
Thanks in advance
Regards
Jailani
 
itisha jain
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
add a
return;
statement after ur rd.forward(req,resp) statement
try this,this shud remove the error
 
Sravan Kumar
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remove any code that does something with the response object after you commit it [using flush() or close() method].

As itisha said above, if you try to forward a request after you commit the response, you will receive an IllegalStateException.
 
Eddy Lee Sin Ti
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Would you mind to post associated code? So, we can have clearer view on the problem.

Usually, a sendRedirect call or sendError or etc methods call that attempt to modify the response would cause the error. Just remember finish all your response manipulation before commiting it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic