博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
【Stimulsoft Reports Java教程】运行Java Web Viewer
阅读量:7153 次
发布时间:2019-06-29

本文共 2854 字,大约阅读时间需要 9 分钟。

hot3.png

本教程介绍了在Java报表工具中运行Web查看器的基础知识。例如,在网页上显示带有仪表板的报表。

首先,我们需要创建动态Web项目。

Stimulsoft

接下来将Stimulsoft Java Libs添加到项目中。

Stimulsoft

您还可以转换为Maven项目并配置pom.xml文件以使用Maven中的库。

4.0.0
webviewer
webviewer
0.0.1-SNAPSHOT
war
src
maven-compiler-plugin
3.5.1
1.6
1.6
com.stimulsoft
stimulsoft-reports-libs
2017.1.1

接下来,我们需要在WebContent / WEB-INF文件夹中创建web.xml文件。在这里,我们配置了StimulsoftResource servlet,它检索诸如* .js和图像文件之类的内容,以及使用java web查看器操作的StiWebViewerActionServlet。

stimulsoft_webviewer
index.jsp
StimulsoftResource
com.stimulsoft.web.servlet.StiWebResourceServlet
StimulsoftResource
/stimulsoft_web_resource/*
StimulsoftAction
com.stimulsoft.webviewer.servlet.StiWebViewerActionServlet
StimulsoftAction
/stimulsoft_webviewer_action

在下一步中,我们需要在WebContent文件夹中创建index.jsp页面。在这里,我们加载Dashboards.mrt报告模板文件并呈现报表。我们还可以配置Web查看器,例如将背景颜色设置为灰色。最后,将Web查看器标记放到jsp页面。

<%@page import=";com.stimulsoft.base.drawing.StiColorEnum"%><%@page import=";com.stimulsoft.base.drawing.StiColor"%><%@page import=";com.stimulsoft.webviewer.StiWebViewerOptions"%><%@page import=";com.stimulsoft.webviewer.StiWebViewer"%><%@page import=";java.io.File"%><%@page import=";com.stimulsoft.report.StiSerializeManager"%><%@page import=";com.stimulsoft.report.StiReport"%><%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><%@ taglib uri="http://stimulsoft.com/webviewer" prefix="stiwebviewer"%>
Stimulsoft Reports for Java <% StiReport report = StiSerializeManager.deserializeReport( new File(request.getSession().getServletContext().getRealPath("/reports/Dashboards.mrt"))); report.render(); StiWebViewerOptions options = new StiWebViewerOptions(); options.getAppearance().setBackgroundColor(StiColorEnum.Gray.color()); pageContext.setAttribute("report", report); pageContext.setAttribute("options", options); %>

现在,您可以将项目部署到Tomcat并运行它。

Stimulsoft

在下面的屏幕截图中,您可以看到示例代码的结果。

Stimulsoft

转载于:https://my.oschina.net/u/3905944/blog/2878661

你可能感兴趣的文章
利用css transition属性实现一个带动画显隐的微信小程序部件
查看>>
DIV+CSS中清除浮动的7种方法分析
查看>>
sql server 2008 评估期已过期
查看>>
关于我
查看>>
生物化学的一些语料库资源网站【转载】
查看>>
BZOJ 3027: [Ceoi2004]Sweet
查看>>
基于中值滤波或双边滤波方式的图像去雾效果的研讨。
查看>>
强制重启N种方法
查看>>
swift中的字符串的一些运用
查看>>
matlab任务:FCM分类
查看>>
Android的GridView和Gallery结合Demo
查看>>
【weixin】微信支付---Native支付模式一
查看>>
Spring Cloud Config采坑记
查看>>
程序执行时,提示数据包堵塞,数据库时不时断开的问题
查看>>
OpenGL ES入门指南-原理(转载)
查看>>
ASP.NET Core 介绍
查看>>
《哈佛大学公开课:幸福课》学习笔记(2)
查看>>
20050606:答辩完了
查看>>
json库
查看>>
autofac文档:循环依赖
查看>>