weixin_42361134 2010-03-18 15:21
浏览 193
已采纳

有关JFreeChart显示问题

[color=darkred]Action:
public ActionForward shopprint(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
String filename="";
PrintWriter out = null;
String month ="";
String shopnum= request.getParameter("shopnum");
month ="2010-02";
request.setAttribute("shopnum", shopnum);
try{
JFreeChart chart=mutiTimeLineChart.createChart(mutiTimeLineChart.getDataset(month, shopnum));
chart.setBackgroundPaint(Color.YELLOW);
ChartRenderingInfo info=new ChartRenderingInfo(new StandardEntityCollection());
try {
HttpSession session = request.getSession();
filename=ServletUtilities.saveChartAsPNG(chart, 900, 400,info, session);
request.setAttribute("filename", filename);
} catch (IOException e) {
e.printStackTrace();
}
try {
ChartUtilities.writeImageMap(out, filename, info, false);
} catch (IOException e) {
e.printStackTrace();
}
out.flush();
}catch(Exception e){
e.printStackTrace();
}
return mapping.findForward("shopprint");
}

页面:shopprint
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="/WEB-INF/c.tld" prefix="c"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="java.io.PrintWriter"%>
<%@page import="com.dahe.huigou.action.mutiTimeLineChart"%>
<%
String fileName = (String)request.getAttribute("filename");
String imgURL=request.getContextPath()+"/servlet/DisplayChart?filename="+fileName;
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



无标题文档


  • 写回答

1条回答 默认 最新

  • CaiHuajiang 2010-03-18 15:52
    关注

    [quote]ChartUtilities.writeImageMap(out, filename, info, false); [/quote]
    检查四个参数谁没有赋值,,根据观察,out可能没有赋值

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥60 请查询全国几个煤炭大省近十年的煤炭铁路及公路的货物周转量
  • ¥15 请帮我看看我这道c语言题到底漏了哪种情况吧!
  • ¥66 如何制作支付宝扫码跳转到发红包界面
  • ¥15 pnpm 下载element-plus
  • ¥15 解决编写PyDracula时遇到的问题
  • ¥15 有没有人能解决下这个问题吗,本人不会编程
  • ¥15 plotBAPC画图出错
  • ¥30 关于#opencv#的问题:使用大疆无人机拍摄水稻田间图像,拼接成tif图片,用什么方法可以识别并框选出水稻作物行
  • ¥15 Python卡尔曼滤波融合
  • ¥20 iOS绕地区网络检测