EOS6.0页面流取出list在jsp得到list及entity下的制定property的值
<%@page pageEncoding="UTF-8"%>
<%@page import="java.io.PrintWriter"%>
<%@page import="com.uniper.itsm.chart.BarChart"%>
<%@page import="org.jfree.chart.plot.PlotOrientation"%>
<%@page import="org.jfree.chart.axis.AxisLocation"%>
<%@page import="commonj.sdo.DataObject"%>
<%@page import="com.eos.web.taglib.util.*" %>
<html>
<head>
<title>展示柱图</title>
</head>
<body>
<%
BarChart chart = new BarChart();
//获得request数据域
Object root= com.eos.web.taglib.util.XpathUtil.getDataContextRoot("request", pageContext);
// "LIST" 为页面流上的Xpath(DataObject数组,获得list对象
DataObject[] entity=(DataObject[])XpathUtil.getObjectByXpath(root,"LIST");
//LIST下有几个entity
int len = entity.length;
for (int i =0;i<len;i++){
String name = (String)entity[i].get("NAME");
int value = entity[i].getInt("VALUE");
chart.setValue(value,name, "数量");
}
%>
<%
String title=(String)request.getAttribute("title");
String filename = chart.generatePieChart(title, session,new PrintWriter(out), 400, 200,PlotOrientation.VERTICAL,AxisLocation.BOTTOM_OR_LEFT);
String graphURL = request.getContextPath()+ "/DisplayChart?filename=" + filename;
%>
<body>
<table width="150" height="100%" >
<tr align="center" bgcolor="#F0F8FC">
<td><img src="<%= graphURL %>" width=400
height=200 border=0 usemap="#<%=filename%>"></td>
</tr>
</table>
</body>
</html>