I have one jsp page which contains two text fields Start Date and End Date. User will input start date and end date and then I will query the database for data between those dates. When I click submit, it will just forward it to the current page and I will pass the dates as parameters. So far so good, but the problem is the image jfreechart does not refresh unless i refresh the browser itself.
Here is my form.
<form method="GET" action='monitor' name="check">
<table>
<tr>
<td>Start Date (dd/MM/yyyy format):</td>
<td><input type="text" name="startDate"
value="<%=startDate%>"></td>
</tr>
<tr>
<td>End Date (dd/MM/yyyy format):</td>
<td><input type="text" name="endDate" value="<%=endDate%>"></td>
</tr>
<tr>
<td><input type="submit" value="check"></td>
</tr>
</table>
</form>
<img src="lineChart.png" width="600" height="400" border="0" usemap="#chart" />
Here is my inline code for generating the chart
final File file1 = new File(getServletContext().getRealPath(".") + "/lineChart.png");
ChartUtilities.saveChartAsPNG(file1, chart, 600, 400, info);
I tried doing writeChartAsPNG but it will overwrite the whole page. Page should still look like,
Start Date:
End Date:
[ VIEW ]
Monitor Data Chart
[ chart here ]