Statement pStmt = conn.createStatement() ;
ResultSet rs = pStmt.executeQuery("select t.id,t.name from scgl t");
while(rs.next()){
out.print(rs.getString(1));
out.println(rs.getString(2));
}
//以上是构造相关的数据集RS.因为只要把RS对象传给报表模版的数据集即可.
MREngine engine = new MREngine(pageContext); //建立引擎对象
engine.setRootPath("/Reports/"); //设置报表根目录
engine.addMRDataSet("scgl",rs); //加入数据集
//engine.addDataSet();
engine.bind("NewReport1"); //绑定模板
%>
<ming:MRViewer id="MRViewer" shownow="true" width="100%" height="100%"/> <!--用标签显示-->
</body>
</html>