implement jive component functionalities in Jasper

2019-08-22 02:26发布

问题:

We need Jive component features (mainly Column sorting upon click of column header) in Jasper library 6.3.

For this, we have downloaded the sample from http://community.jaspersoft.com/wiki/table-sortinginteractivity-example-jasperreports-library-demos and are trying to build our report in a similar way.

We have written a Custom data source and set this as the data source expression for the Report/ Table/ Data Set in the JRXML file. We create an object of this data source and pass it as a parameter in the context-map.

We have written a Custom servlet which extends the Jasper AbstractServlet - it's code is similar to the ViewerServlet present in the sample, except that it creates an Object of our data-source and puts it in the context-map. Then it calls VelocityUtil.processTemplate () with the body template and context-map. This Servlet is also set as the Custom viewer in the web.xml file:

<servlet>
<servlet-name>CustomViewerServlet</servlet-name>
<servlet-class>MyCustomReportServlet</servlet-class>
<init-param>
    <param-name>net.sf.jasperreports.web.servlets.viewer.header.template</param-name>
    <param-value>viewer/CustomHeaderTemplate.vm</param-value>
</init-param>
<init-param>
    <param-name>net.sf.jasperreports.web.servlets.viewer.body.template</param-name>
    <param-value>viewer/CustomBodyTemplate.vm</param-value>
</init-param>
<init-param>
    <param-name>net.sf.jasperreports.web.servlets.viewer.footer.template</param-name>
    <param-value>viewer/CustomFooterTemplate.vm</param-value>
</init-param>

However, when we invoke this Servlet from the browser by giving it's URL and passing the parameters it needs, it just renders a blank blue screen with disabled arrow buttons for Next/ Previous. No data is coming in the report, and it seems the next () and getFieldValue () methods of our data-source are also not getting invoked.

Please help resolve this. Any links to steps that need to be followed for enabling Jive components using a custom data-source will be appreciated.