Create a JSP Page Print Template

From ISV Support Wiki

Create a JSP Page Print Template
Jump to: navigation, search

Contents

Creating the Template Page

  1. 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.)
  2. Edit the page either in the platform, or using the Eclipse Plug-In.
  3. Add boilerplate text and fixed graphics
  4. 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");
%>

File:notepad.png

Note: Although the object_id is alphanumeric, it can be used in any API that requires an object name.

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.)

Learn More

Views
Categories
Personal tools