http://gocom.primeton.com/blog19014_15440.htm?PHPSESSID=db7e8103fd51917ea949ebab28ee6a57
代碼如下:
<%@page pageEncoding="UTF-8" import="java.util.*"%>
<%@page import="com.eos.web.taglib.util.*" %>
<%@page import="commonj.sdo.DataObject,commonj.sdo.Property" %>
<%@include file="/common/common.jsp"%>
<%@include file="/common/skins/skin0/component.jsp" %>
<html>
<!--
- Author(s): lijd
- Date: 2009-04-28 17:47:57
- Description:
-->
<head>
<title>Title</title>
</head>
<body>
<%
Object root= com.eos.web.taglib.util.XpathUtil.getDataContextRoot("request", pageContext);
DataObject[] objs=(DataObject[])XpathUtil.getObjectByXpath(root,"outObjs");// "outObjs" 為頁面流上的Xpath(DataObject數組)
int len = objs.length;
String outStr = "Length:"+len+"CONTENT:";
for (int i =0;i<len;i++){
List list=objs[i].getInstanceProperties();
Iterator it=list.listIterator();
while(it.hasNext()){
Property pro=(Property)it.next();
outStr=outStr+pro.getName()+"-"+objs[i].get(pro)+",";
}
outStr=outStr+"|";
}
System.out.println(outStr);
%>
</body>
</html>