SAS 9.1.3 Integration Technologies » SAS Web Infrastructure Kit: Developer's Guide


Developing Custom Portlets
Development Steps
Creating a Deployment Descriptor
Creating Display Resources Files
Developing the Presentation JSP Page
Creating Action Classes
Implementing Portlet Help
Creating a PAR File
Use Cases
Simple Display Portlet
Localized Portlet
Portlet Template (Editable Portlet)
Remote Portlet
Tips and Best Practices
Using the Portlet API
Sample Portlets
Localized Display Portlet (Welcome)
Interactive Form Portlet (FormExample)
Portlet Template, or Editable Portlet (DisplayURL)
Web Application (HelloUserWikExample)
Remote Portlet (HelloUserRemote
Portlet
Development Steps

Developing the Presentation JSP Page

JavaServer Page (JSP) pages are the presentation components of local portlets. Because you can define a local portlet's initialization, actions, security settings, and resource paths in the portlet deployment descriptor, the JSP page does not need to contain this information.

In developing the JSP page, you can use the following tags:

  • tags from the JSP Standard Tag Libraries (JSTL).

  • tags from the Struts tag libraries.

  • SAS custom tags, which are available with SAS AppDev Studio (WebAF). For information about these tags, see the webAF Reference page on the AppDev Studio Developer's Site.

When you create a JSP page for a portlet, the only requirements are the following:

  • The JSP page must be an HTML fragment:

    • The page must not contain starting and ending <HTML>, <HEAD>, or <BODY> tags.

    • The page must be able to be displayed inside a table cell in an HTML document.

  • If the JSP page includes custom tags from a tag library, you must include a taglib directive before the first use of a tag from that library. For the JSTL format tab library, use this taglib directive:

    <%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt"%>

  • You must include a UTF-8 directive if you want the JSP page to provide full support for internationalization. This directive causes all user input to be encoded in the 8-bit Unicode Transformation Format, which supports all of the world's languages, including those that use non-Latin1 characters.

    Note: The portal Web application supplies this directive when it displays portlets on a portal page. However, you must supply the directive to ensure correct internationalization when your portlet is displayed from the Search Results panel. You should consider making your portlet actions extend HTMLPortletAction, because this class supplies the directive.

    The syntax for the UTF-8 directive is:

    <%@ page contentType= "text/html; charset=UTF-8"%>
  • The JSP cannot import Java classes from the portlet's PAR file.

The SAS Web Infrastructure Kit includes a number of sample JSP pages that you can use as templates for creating your own custom JSP pages. The samples can be found as follows:

  1. Go to the DeployedPortlets directory of the portal setup directory. For example, if you used the default installation location on a Windows system, then you would go to c:\Program Files\SAS\Web\Portal2.0.1\DeployedPortlets.

  2. Use a utility such as WinZip to open the portlet archive (PAR) file for the portlet whose JSP page you want to access. You can then extract the JSP file from the archive.