Create a JSP Page Print Template
From ISV Support Wiki
Contents |
Creating the Template Page
- Start by creating a JSP/Html Page in the platform.
- Turn off the Include Headers option for that page.
- (Those headers contain platform-specific Javascript that interfere with template processing.)
- Edit the page either in the platform, or using the Eclipse Plug-In.
- Add boilerplate text and fixed graphics
- Use JSP code and the platform APIs to control page content, as explained below.
Accessing Record Information
When a JSP Page is launched from a context that is associated with a particular object record, the request object available in the JSP page contains the identifiers needed to obtain additional information from the record, using either the REST record Resource or the Java record handling APIs.
To obtain record identifiers from the request object:
-
<%
String object_id = request.getParameter("object_id");
String record_id = request.getParameter("record_id");
%>
To list all of the parameters available in the request object and display their values:
-
<%
String[] params = request.getParameterValues();
for (int i=0; i<params.length; i++)
{
String paramName = params[i];
String paramValue = request.getParameter( paramName );
}
%>
Using APIs
In general, the Java APIs and REST APIs provide equivalent functionality. But there are some differences, as well. So while the Java APIs are generally more convenient to use in a JSP page, you may also want to review the functionality listed in the REST API CheatSheet.
The following Java API classes are implicitly imported into JSP Pages:
Other considerations:
- You cannot make a database connection. (Use the Java Record Handling APIs, instead.)
- The maximum number of loop iterations, along with other restrictions, is determined by the configuration of the platform Governors.)