jsp文件:<%@ page import="org.jfree.chart.ChartFactory,org.jfree.chart.JFreeChart,org.jfree.chart.plot.PlotOrientation,org.jfree.chart.servlet.ServletUtilities,org.jfree.data.category.CategoryDataset,org.jfree.data.general.DatasetUtilities"%><%double[][] data = new double[][] {{672, 766, 223, 540, 126}, {325, 521, 210, 340, 106}, {332, 256, 523, 240, 526} };String[] rowKeys = {"苹果","梨子","葡萄"};String[] columnKeys = {"北京","上海","广州","成都","深圳"};CategoryDataset dataset = DatasetUtilities.createCategoryDataset(rowKeys, columnKeys, data); JFreeChart chart = ChartFactory.createBarChart3D("水果销量统计图","水果","销量",dataset,PlotOrientation.VERTICAL,false,false,false);String filename1 = ServletUtilities.saveChartAsPNG(chart, 500, 300, null, session);String graphURL = request.getContextPath() + "/servletDisplayChart?filename=" + filename1;%>
配置web.xml DisplayChart org.jfree.chart.servlet.DisplayChart DisplayChart /servletDisplayChart