使用Struts2在网页中显示JFreeChart [英] Displaying JFreeChart in a web page using Struts2
本文介绍了使用Struts2在网页中显示JFreeChart的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Struts2.我需要在网页中显示JFreeChart.有人可以帮我吗?
I am using Struts2. I need to display JFreeChart in a web page. Can any body help me on that?
它以二进制格式显示.
public String execute() throws Exception {
System.out.println("Refresh bar Chart");
response.setContentType("image/png");
OutputStream outstream = response.getOutputStream();
try {
JFreeChart chart = getChartViewer();
ChartUtilities.writeChartAsPNG(outstream, chart, 500, 300);
System.out.println("Created bar Chart");
return SUCCESS;
} finally {
outstream.close();
response.flushBuffer();
}
}
推荐答案
有一个插件: http://struts.apache.org/2.x/docs/jfreechart-plugin.html
这篇关于使用Struts2在网页中显示JFreeChart的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文