生产的图片url和mapfile的路径分开存放,确保你传回jsp/html页面里面的image url和mapfile都是有值的
之前写的jfreechart map热点图示例,我用的一个POJO chatVo来保存返回的image url和mapfile数据,客户端用ajax,封装为json:try
{
//生成的动态图名
String charFileName = ServletUtilities.saveChartAsPNG(chart, 220, 260, info, request.getSession(true));
//超链接所需要的map\
String mapFile = ImageMapUtilities.getImageMap(charFileName, info);
String graphURL = request.getContextPath() + "/DisplayChart?filename=" + charFileName;
charVo.setChartFileName(charFileName);
charVo.setChartURL(graphURL);
charVo.setChartMap(mapFile);

}
/*产品投票统计图*/
function showVoteChart(divElemntId)
{
$.ajax({
   type:"post",//请求方式
   url:"/webfin/news.action?method=showVoteChart&ver="+Math.random(),
   data:{//发送给数据库的数据
//    childProdCode:childProdCode
   },
   dataType: "json",
   //请求成功后的回调函数有两个参数
     success:function(data){
             var textHtml = data.chartMap+"\n";
   textHtml += "<img id='chartImg' src='"+data.chartURL+"' usemap='#"+data.chartFileName+"' ></img>\n";
   $('#'+divElemntId).html(textHtml);    },
   error: function (msg) {
   alert("FundNews.js testVoteChart Error!"+msg.text());
   }    });
 
     
}

解决方案 »

  1.   

    我现在的程序 在后台执行的时候下面的代码
    String mapFile = ImageMapUtilities.getImageMap(charFileName, info);
    只能得到下面部分
    <map id="jfreechart-23449.png" name="jfreechart-23449.png">
    </map>
    并没有area,这个很纳闷。
      

  2.   

    我现在的程序 在后台执行的时候下面的代码
    String mapFile = ImageMapUtilities.getImageMap(charFileName, info);
    只能得到下面部分
    <map id="jfreechart-23449.png" name="jfreechart-23449.png">
    </map>
    并没有area,这个很纳闷。
      

  3.   


    charVo.setChartFileName(charFileName);
    charVo.setChartURL(graphURL);
    charVo.setChartMap(mapFile);---这里面的chartMap变量存放的就是area数据,你需要在javacript里面写到你的<image>元素前面:var textHtml = data.chartMap+"\n";
      

  4.   


    我现在的问题是在后台 就没有给map附上值或者没有取到,真行不知道怎么弄呀。
    String mapFile = ImageMapUtilities.getImageMap(charFileName, info);