J2EE Dashboard Reporting Integration

Dashboard reports can be embedded in a Java Server Page (JSP) by using the custom tag library provided with InetSoft's J2EE compliant software.

Request a Demo
Register for Pricing
#1 Ranking: Read how InetSoft was rated #1 for user adoption in G2's user survey-based index Read More

Header Tag

In the HTML head tag, you need to include the report header tag. The only attribute passed to this tag is the reportId. The header tag is responsible for writing java script functions which are used by the report toolbar buttons (mail, export etc). It also writes some external CSS data for the presentation of the report.:

<html>
 <head>
 <title>My Report Page</title>
 <sree:header reportId="myReport"/>
 </head>
demo
Read how InetSoft saves money and resources with deployment flexibility.

Toolbar and Body Tags

The Body Tag must be present to ensure cor­rect generation of the report. The HTML body tag must have the onLoad attribute defined with the scriptlet <%=pageContext.getAttribute("sreeOnLoad")%> appended to any onLoad java script you have defined. This is used for invoking java script written by the header tag when the page loads.

The toolbar and body can be placed anywhere within the HTML body. Both tags require the reportId attribute.

 <body onLoad="initMyPage();<%=pageContext.getAttribute ("sreeOnLoad")%>">
    <p>This report shows sales for the state of New York.</p>
      <sree:toolbar reportId="myReport"/>
    <sree:body reportId="myReport">
      <p>Please wait while the report is being generated.</p>
    </sree:body> 

The content enclosed in the body tag is written if the report is not yet available and the processPage attribute of the create tag is set to true. The toolbar tag can also optionally include content that will be written if the page is not available.

Learn about the top 10 features of embedded business intelligence.

Button Tag

The button tag provides you with the means to fully customize any toolbar button on an individual report basis. It requires the reportId attribute as well as the type attribute. The type attribute specifies which toolbar button the tag inserts. The different types of tags are listed in Appendix C: Tag Library Reference.

Additional attributes of the button tag include image, text, useImage and actionClass. These attributes allow you to change how each button is presented. The image attribute specifies the URL of the icon to use if the button is an image type button. The supported URL protocols and expected format of this attribute are defined in Appendix C: Tag Library Reference. The text attribute specifies the text that should be used for the link if the button is a text type button. The useImage attribute specifies whether the button will use an image or text. The actionClass attribute specifies the fully qualified class name of the action class that is called when the button is clicked. This attribute is required when the button type is “user”. The values of these attributes will override the settings in the SREE properties file. If an attribute is omitted, the default setting will be used.

The button tag will only write the button if it would normally be displayed in the toolbar. For example, the previous page button would not be written on the first page, and if the user does not have analytic capabilities then the 'Ad Hoc' button will not be shown.

Like the toolbar and body tags, the button tag can contain content that will be written if the report is not yet available and can be placed anywhere in the HTML body.

Listing 1. Embedding Report in a JSP 

<%@taglib uri="sree.tld" prefix="sree"%>
 <% String orderDate = request.getParameter("order_date"); %>
 <sree:cache jspId="reportJsp"/>
 <sree:create reportId="myReport" name="My Folder/My Report" processPage="true">
    <sree:parameter name="State" value="NY" type="string"/>
    <sree:parameter name="OrderDate"
       value="<%= orderDate %>" type="date"
       format="yyyy-MM-dd"/> </sree:create>
   <html>
    <head>
       <title>NY Sales Report</title>
       <sree:header reportId="myReport"/>
       <link rel="stylesheet" href="hostStyle.css"
           type="text/css"/>
    </head>
    <body onLoad="
       <%= pageContext.getAttribute("sreeOnLoad") %>">
       <h1>Sales Summary for NY on <%= orderDate %></h1>
       <hr>
       <sree:toolbar reportId="myReport"/>
       <sree:body reportId="myReport">
           <p>Please wait while the report is loading.</p>
       </sree:body>
    </body>
 </html>

 Listing 2. Using Individual Buttons in a JSP

 <%@taglib uri="sree.tld" prefix="sree"%>
 <sree:cache jspId="reportJsp"/>
 <sree:create reportId="myReport" name="My Folder/My Report" processPage="false"/>
 <html>
    <head>
       <title>Sales Report</title>
       <sree:header reportId="myReport"/>
    </head>
    <body onLoad="
       <%= pageContext.getAttribute("sreeOnLoad") %>">
       <sree:button reportId="myReport" type="first-page"/>
       <sree:button reportId="myReport" type="previous-page"
           image="http://myhost.com/image.gif"/>
       <sree:button reportId="myReport" type="page-box"/>
       <sree:button reportId="myReport" type="next-page"
          image="images/image.gif"/>
       <sree:button reportId="myReport" type="last-page"
          image="jar:/usr/java/pkg.jar!/images/image.gif"/>
       <sree:button reportId="myReport" type="pdf"
          image="resource:/images/image.gif"/>
       <sree:button reportId="myReport" type="export"
          image="file:///usr/share/images/image.gif"/>
       <sree:button reportId="myReport" type="reload"
          useImage="false" text="Reload Report"/>
       <sree:button reportId="myReport" type="user"
          actionClass="com.mycompany.report.ReportAction"/>
       <sree:body reportId="myReport"/>
    </body> </html>
Read the top 10 reasons for selecting InetSoft as your BI partner.

Handling Unicode

If a report is passing a parameter with a unicode value, it must be decoded to be displayed properly. We provide a JavaScript function to do this.

<script language="JavaScript" src="/inetsoft/sree/internal/markup/encodeUtil.js">
</script> <script language="JavaScript" > 
var decoded = byteDecode(encoded_parameter); 
</script>
Previous: J2EE Report Generation