java如何使用水晶报表_Java操作水晶报表

阅读: 评论:0

java如何使⽤⽔晶报表_Java操作⽔晶报表Java操作⽔晶报表DAO类:
public static ResultSet getResultSet(final int scrollType) {
ResultSet resultSet = null;
String query = "";
导丝男士try {皮黔生
Connection conn = Connection();
String sql = "select * from table1";
resultSet = ateStatement().executeQuery(sql);
} catch (Exception e) {
System.out.Message());
高级律师}
return resultSet;
}
Action类如下:
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
operatorName = Parameter("operatorName");
httpSession = Session();
boolean flag = this.ReportSourceInSession("reportSource", httpSession);
if (true) {
request.setAttribute("field", this.setOperator("operator", operatorName, ""));
return mapping.findForward("success");
王安石百科
} else
return mapping.findForward("error");
苏州阳光健身卡
}
public boolean ReportSourceInSession(String session_name,
HttpSession session) {
boolean flag = false;
try {
ReportClientDocument reportClientDoc = new ReportClientDocument();
reportClientDoc.open("result.rpt", 0);
ResultSet resultSet = CrytalReport
.getResultSet(ResultSet.TYPE_SCROLL_INSENSITIVE);
String tableAlias = DatabaseController()
术尔泰
.getDatabase().getTables().getTable(0).getAlias(); DatabaseController().setDataSource(resultSet, tableAlias, "reportSource");
session.setAttribute(session_name, reportClientDoc
.getReportSource());
flag = true;
return flag;
} catch (Exception e) {
System.out.Message());
return flag;
}
}
JSP页⾯内容如下:
Result
Object reportSource = Attribute("reportSource"); CrystalReportViewer crViewer = new CrystalReportViewer(); crViewer.setOwnPage(true);
crViewer.setOwnForm(true);
crViewer.setReportSource(reportSource);
crViewer.setPrintMode(CrPrintMode.ACTIVEX);
crViewer.setParameterFields((Attribute("field")); crViewer.setEnableParameterPrompt(false);
crViewer.processHttpRequest(request, response, this
.getServletConfig().getServletContext(), null);
%>

本文发布于:2023-07-05 17:35:09,感谢您对本站的认可!

本文链接:https://patent.en369.cn/xueshu/174420.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:操作   男士   苏州
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2022 Comsenz Inc.Powered by © 369专利查询检索平台 豫ICP备2021025688号-20 网站地图