I have a servlet in which I want to output normal text and also dynamically created images.
The generated web page has a header and footer included with
request.getRequestDispatcher("header.jsp").include(request, response);
Doing that lead to an expection:
org.apache.jasper.JasperException: java.lang.IllegalStateException: getOutputStream() has already been called for this response
I can I achieve this? (Header, text, image, text, footer)
The image must not be streamed in the same request as the HTML page: the generated HTML must be :
When loading this HTML page, the browser will trigger a second request to
path/to/servlet/streaming/the/image/bytes, and the servlet mapped to this path should use the response output stream to send the dynamically generated image bytes.