THanks for responding.
Actually it works like this current jsp is just an intermediate page and request is coming from client server. I think client server is redirecting the request.I knew why that error is coming but what could be the solution for it?
Try making this JSP into a Servlet.
That way you will know for certain it isn't writing/committing anything to the response.
Its all java code anyway. No reason for it to be in a JSP.
Responses get committed once you start writing the response. That means you can't forward/redirect once you have started returning an answer.
By default JSP pages have a buffer that gives you a bit of leeway. You can start output, and then forward/redirect - it will just clear the buffer and start from "scratch"
Cases where you get this error
- the buffer fills up and is flushed (default Buffer is 8k)
- the buffer explicitly gets flushed
In terms of fixing the problem
1 - rewrite as a servlet to eliminate possible HTML being output from this JSP page..
2 - move the forward/redirect logic further up so that it runs before the buffer is executed.
3 - another thing to watch out for is if you forward/redirect to another resource, you should not do any other output in a JSP
Joined: Oct 27, 2009
Thanks every one for you response. The actual problem was there is one more security server on top of our web server which writes to response and then redirects to our server. That's why it was throwing error. And for solution I just set a new page action refereshed the page and it worked. Thanks again for all your comments.