润乾报表配置技术路线

2016-10-25 11:20

Wow! Now we are close to modify one of the most important file to configureàweb.xml

to the left the web.xml in WEB-INF directory has to be modified with added information like below:

<!--润乾配置-->

 <servlet>

    <servlet-name>SetContextServlet</servlet-name>

    <servlet-class>com.runqian.util.webutil.SetContextServlet</servlet-class>

    <load-on-startup>2</load-on-startup>

  </servlet>

  <servlet>

    <servlet-name>reportServlet</servlet-name>

    <servlet-class>com.runqian.report4.view.ReportServlet</servlet-class>

    <init-param>

      <param-name>configFile</param-name>

      <param-value>/WEB-INF/reportConfig.xml</param-value>

    </init-param>

    <load-on-startup>1</load-on-startup>

  </servlet>

The annotated part of code is not mandatory to this project but we leave it there for info

<!--

  <servlet>

    <servlet-name>DMServlet</servlet-name>

    <servlet-class>com.raq.web.view.DMServlet</servlet-class>

    <init-param>

      <param-name>configFile</param-name>

      <param-value>/WEB-INF/dmConfig.xml</param-value>

    </init-param>

    <load-on-startup>10</load-on-startup>

  </servlet>

-->

 

  <servlet-mapping>

    <servlet-name>reportServlet</servlet-name>

    <url-pattern>/reportServlet</url-pattern>

  </servlet-mapping>

 

<!--

  <servlet-mapping>

    <servlet-name>DMServlet</servlet-name>

    <url-pattern>/DMServlet</url-pattern>

  </servlet-mapping>

  <servlet-mapping>

    <servlet-name>DMServlet</servlet-name>

    <url-pattern>/DMServletAjax</url-pattern>

  </servlet-mapping>

-->

Element tag of <resource-ref> is not known well why it is here. But it seesm no harm and probably mandatory so we keep it safe here. However the information has to be project specific.

  <resource-ref>

       <description>dameng6</description>

       <res-ref-name>dameng6</res-ref-name>

       <res-type>javax.sql.DataSource</res-type>

       <res-auth>Container</res-auth>

</resource-ref>

The config above has to be modified to be the one below in order to be project specific configured.

OK It seems we have fone all necessary configuration to validate the pmlf_hebei project to be able publishing ruqnian report.But actually we forget one thing one important thing which is just the raq files have to be aslo added into the code/web/runqian/raq/report; also the images and all contents of its subdirectory have to be added too. So Stupid!!!

 

FINALLY, WITHOUT TOO MUCH SURPRISE, THE PROJECT STARTED WITH SUCCESS. IT SHOWS INFO BELOW.

 

 

 

We still have error saying that fillableTable.raq is not existing in the designated directory.what happened? We checked and recalled that there is likely one configuration in “reportConfig.xml” about reportFilesHome.we likely miss this in the current project

we also have to copy and replicate all files under code/web/runqian, though we do not know exactly what they do mean to us for now but we think it will serve a purpose that we do not know we do not know now.so we leave them in place for future.

接着又报错了,我们发现报错的是数据源

   
   

可是我们反复检查了reportConfig.xml和web.xml以及META-INF下的context.xml文件的数据源配置,根本没有任何和dameng6有关的配置,那么dameng6有关的配置是从哪里来的?思前想后应该是设计器设计的时候因为制定了数据源所以为报表文件绑定了数据源的指定,换言之就算在项目所有的地方都配置好了数据源,如果这个报表文件一开始不是从系统使用的数据库设计的那还是不能用,需要回到报表设计器重新指定绑定了需求数据源后从新发布一个报表文件导入到 eclipse项目中。

好了不管怎样,必须要从数据源指定的地方创建报表文件

1 ok the dataSource is added and connected

13:25 这个报表工具挺强大,还可以实现自动分页在excel理论上说我们导入表格的时候也可以实现自动分页吧?

我们来测试一下可填报功能,这是原始数据备份以防我们修改了以后不知道改成什么。

执行填报后发现,数据已经被成功的持久化到数据库了.

 

最左边的显示了当显示结果很大的时候输出excel文件可以自动分页实现多个sheet页面分割,显得非常专业高大上。

 

 

 

 

如右图我们已经在快逸自己系统下创建了由所需要的数据源创建的可填报的报表文件pmlf_hebei_user.raq 这意味着我们现在需要把它植入到pmlf_hebei系统的runqian/raq/report路径下。最重要的是要在demo.jsp中进行配置显示正确的报表文件路径。

左下图是项目code/runqian路径下的报表文件所在的位置。注意这是用设计器从新设计的。 之后的工作就应该是在demo.jsp中配置路径了

刚才我犯了一个傻逼的错误,我在用F12开发者工具调试的时候不小心误把禁用脚本给选中了导致润乾报表的填报功能就在IE下不能用了,不过火狐和谷歌浏览器照样用。半天才搞定,以后要注意啦

 

我们现在发现如果在报表设计器中设计的pmlf_hebei_user.raq报表然后在tomcat下发布是可以的,但是为什么到了eclipse中的pmlf_hebei项目就不行了呢?

2016-10-26

经过昨天的调试发现servlet/jsp规范2.4以上版本都不支持润乾报表的页面js生成,所以必须要用没有头信息的web-app配置,如果使用2.3的话就必须要按照严格的规范形成web.xml里的配置顺序,不能随意安排。

 

原文地址:https://www.cnblogs.com/zhanglingfei/p/5999275.html