I'm using JFreeChart to generate a dynamic chart depending on some data thet is coming from databse. I have a JSP with one combobox, the user makes the input and submits it, and the Action process it, generating an image of a chart. I need to display this image on the same JSP as before, below the combobox.but it is only graph image coming on page.how can i make it on same page?
I'm using spring on my webapp.
Thanks in advance.
The easiest way is to use JavaScript. When the form is submitted, intercept the submission by a JavaScript event handler, and then simply insert an
<img>tag in the page, where you want the graph to appear. This image should have the URL of the action generating the graph.With jQuery, it would look like this:
If the graph changes each time it's generated, even for a similar selection, you should add some random parameter at the end of the URL to prevent browser caching.