This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
As Bear and Paul mentioned you would need refractor your code pretty much.
For every http request,
- the servlet container creates a request and response objects.
- your servlet uses the data in the request to process
- it sets back necessary data in the response object
- the Servlet container based on your page forward responds back as a jsp
At this last step when the response leaves your container, your outputstream will be committed and you cannot modify it later.
Here you are trying to modify the committed response in your result jsp which will throw you a response saying outputstream is already committed