I am trying to display a chart with its map on a jsp page and using struts framework.
Here is the code I am using right now :
Action code
Code: Select all
JFreeChart chart;
String mapName;
response.setContentType("image/png");
HttpSession session = request.getSession();
OutputStream out = response.getOutputStream();
[...]
ChartRenderingInfo info = new ChartRenderingInfo(
new StandardEntityCollection());
ChartUtilities.writeChartAsPNG(out, chart, 400, 300, info);
String map = ImageMapUtilities.getImageMap(mapName, info);
session.setAttribute("chartMap", map);
Code: Select all
<img src='Chart.do?action=getChart' usemap="#chartMap<%=i%>"/>
<%=session.getAttribute("chartMap") %>
Is there another solution to send the map so that it apperas on the first loading of the page ?
Thank you