I. Description
When creating a template, you may sometimes need to pass the parameters or some values in the report to your own web page for some processing. At this time, how do you pass the values in the report to the web page?
II. Idea
Go to the webpage by setting the hyperlink and set the parameters, and then get the parameters through request.getParameter("parameter name in the hyperlink") in the webpage.
III. Example
1. Template preparation
New dataset ds1: SELECT * FROM Shipper
Design the template style as shown below:
The next thing to do is to set the value passed by the hyperlink and get the value set in the web page.
2. Hyperlink setting
Right-click the cell D2 where the modification is located, and click the hyperlink to add a web link. The specific settings are as follows:
Please refer to the completed template:
%FR_HOME%\WebReport\WEB-INF\reportlets\doc-EN\ReportApplication\FeaturesApplication\Hyperlink_pass_web_parameter.cpt
3. Web page to get parameter settings
Get the passed parameters
<%
String ID = request.getParameter("ID");
String TELEPHONE = request.getParameter("TELEPHONE");
%>
The complete code:
<%@ page language="java" pageEncoding="GBK"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%
String ID = request.getParameter("ID");
String TELEPHONE =request.getParameter("TELEPHONE");
%>
<html>
<head>
<title>Modify basic parameter</title>
</head>
<body>
<table width="350" border="0" cellspacing="1" cellpadding="5px">
<tr>
<th width="130">ShipperID:</th><td width="208"><input type="text" id="ID" value="<%=ID %>" disabled/></td>
</tr>
<tr>
<th>Telephone number:</th><td><input type="text" id="TELEPHONE" value="<%=TELEPHONE %>"/></td>
</tr>
</table>
</body>
</html>
Name it update1.jsp and save it in the %TOMCAT_HOME%\webroot directory.
4. Effect preview
Start the Tomcat server, preview the template, and click the hyperlink to see that the corresponding value is transferred to the web page, as shown in the above rendering.
IV. Template download
Please refer to the completed template: %FR_HOME%\WebReport\WEB-INF\reportlets\doc-EN\ReportApplication\FeaturesApplication\Hyperlink_pass_web_parameter.cpt
Click to download:
Hyperlink_pass_web_parameter.cpt