<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <html> <head> <script type="text/javascript" src="<c:url value="/scripts/js/swfobject.js"/>"></script> <script type="text/javascript" src="<c:url value="/scripts/js/json2.js"/>"></script> </head> <body> <script type="text/javascript"> swfobject.embedSWF( "<c:url value="/open-flash-chart.swf"/>", "my_chart", "600", "500", "9.0.0", "expressInstall.swf", {"data-file":"<c:url value='/report/legalRiskOrientaionAnalysis/report.do?pointOfView=legalRisk'/>"}, {wmode:"transparent"} ); </script> <div id="my_chart"></div> </body> </html>
js 文件一定要引入正确,如果错误,将显示不了。如果想传多个参数,如下:将&改为%26
<script type="text/javascript"> function onSelect(str){ var ur = "<c:url value='/report/legalRiskOrientaionAnalysis/report.do?pointOfView=subject3%26legalSubjectId='/>"+str; swfobject.embedSWF( "<c:url value="/open-flash-chart.swf"/>", "my_chart", "600", "500", "9.0.0", "expressInstall.swf", {"data-file":ur}, {wmode:"transparent"} ); } </script>
<action name="report" class="XXAction" method="report"> </action>
public String report() {
String jsonReport = XX.xx(); //此处略
HttpServletResponse response = this.getResponse();
response.setContentType("application/json-rpc;charset=utf-8");
response.setHeader("Cache-Control", "no-cache");
response.setHeader("Expires", "0");
response.setHeader("Pragma", "No-cache");
try {
response.getWriter().print(jsonReport); // 写到客户端
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
至于图形参考 http://hi.baidu.com/harbin_sakura/blog/item/74a5b5198bfb954e42a9ad5f.html
颜色 参考 : http://www.51toria.cn/demo/openflashchart/ofc.html
以上只为记录一下。