I have a problem . I have a screen where when i press a button it goes to the
servlet , and there i am constructing a
rtf or pdf file , then writing to the output stream and closing it. But after that i want to go back to the same
jsp and display some message .
response.setContentType("application/text");
response.setHeader("Content-Disposition",
"inline; filename=\"" + "test.pdf" +"\"");
response().setBufferSize(100*1024); //100KB
OutputStream fos;
fos = response().getOutputStream();
BufferedOutputStream bos = new BufferedOutputStream(fos);
bos.write(data.toString().getBytes());
bos.flush();
bos.close();
after this i have to forward the response to jsp.
I get the exception : java.lang.IllegalStateException: Cannot forward after response has been committed
I am using
struts framework.
I know a response cannot be forwarded to jsp after closing the stream
but still i want to acheive this requirement somehow.
is there any other way of doing it. i believe nothing is impossible