Transferring Data between server and http client
Posted on 2005-05-03
I want to get the contents of my server side query and store them as a file on the client side.
What I am doing is as follows:
I pass a set values from the form(jsp file) to the servlet, based on which a database query is done. Now I write the this queried data in the outputstream object of the HttpServletResponse response object. Now I redirect the page to another JSP file using RequestDispatcher forward function and try to access the outputStream of the servlet as input stream of the request object of the redirected JSP.
And here is where the problem is occuring. It gives me an IllegalStateException. My research tells me that I cannot use RequestDispatcher because if the response object is not commited it gets cleared before redirection and if its is commited it gives an Illegal State Exception.
What I want is that data should be transferred back to browser window and I should see on browser “Open with”, “save to disk” window.
Can anyone help me with this. He gets all the 250 points !!!!
If you need any clarification, mail me at email@example.com