D.7 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 E: JSP 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 E: JSP 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.
<sree:button reportId="type="next-page"
image="images/next.gif" useImage="true"/>
Note: It is often desirable to have an enabled and a disabled version for a button. For example, the 'next' button should be disabled on the last page of the report. This can be achieved by adding another file with the same name as the image file suffixed with '_d'. The two files should be in the same location, e.g., 'next.gif' and 'next_d.gif'
This is an example of a simple but complete JSP page with an embedded report.
Note: Functions such as Ad Hoc editing and Report Explorer are unavailable when the reports are embedded in a JSP.
Listing 2. 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 3. 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>
| << D.6 Toolbar and Body Tags | © 1996-2013 InetSoft Technology Corporation (v11.4) | D.8 Parameters Containing Unicode Characters >> |