Not sure if this is where my question belongs but i'll give it a shot.
I need to display a pdf stored in a byte array in a web browser so this is what i've done so far. First i have a jsp that when submited executes the following:
Where 'OpenPDF' maps to my servlet. The problem is with the following code in the servlet:
The problem is that throws an IllegalStateExeption saying that 'OutPutStream already obtained' since the response being passed in is the response object from the jsp and it has that darn 'out' object.
What can I do about this so that I will be able to display the pdf??? Ideally in a separate window aswell.
posted 8 years ago
If you want to stream binary content, don't involve JSPs. That's causing the problem here. Craft the page flow so that the download request goes directly to the servlet that streams it. Then you should not have any problems.