JFreeChart chart = JFreeChartTool
ToLineChart(list)
try {
HttpSession session = ServletActionContext
getRequest()
getSession()
String filename = ServletUtilities
saveChartAsPNG(chart
null
session)
System
out
println(filename)
String graphURL = request
getContextPath()
+
/servlet/DisplayChart?filename=
+ filename;
request
setAttribute(
graphURL
graphURL)
} catch (IOException e) {
e
printStackTrace()
}
頁面中加入
<img src=
;%= request
getAttribute(
graphURL
) %>
>
From:http://tw.wingwit.com/Article/program/Java/hx/201311/25595.html