I made a Servlet that generates JPEG image. While doing that, it also writes some data into the session bean. JPEG image and bean's data should be displayed on the same JSP. But here is what happens. Displaying of JPEG image is a slower process than rendering HTML tags, so data from the session bean are rendered even before they are populated with Servlet.
Is there any way I can ensure that data from the session bean are displayed after displaying JPEG image?
Here is in more detail. While doing calculations needed to produce my image, I put some of those results in the session bean. In the JSP I call a Servlet that produces image and right after that I have tags that are rendering mentioned results from the session bean. It seems that a problem lies in the fact that browser renders image placeholder and all the text (including data from the session bean) in the page even before the image calculations are finished and all written to the session bean. So browser renders wrong data from the session bean (default or null values).