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
Sample Portlets

Sample: Web Application (HelloUserWikExample)

The HelloUserWikExample application is a Web application that displays the string Hello 'user', where user is the name of the user who is logged on to the portal Web application, as shown in this example:

   Hello 'Portal Demo' 

The HelloUserWikExample application uses SAS Foundation Services to access session information created by the portal Web application, extracts the user's name from the session information, inserts the name in a message, and displays the message to the user.

You can deploy the HelloUserWikExample application as either a remote portlet or a stand-alone application. The HelloUserRemotePortlet sample shows how this application can be deployed in a remote portlet.

If an application is called from a remote portlet, then it must generate an HTML fragment to be displayed within the portlet borders. If an application is to be invoked as a stand-alone application, then its JSP page must generate a complete HTML file (with starting and ending <HTML> tags). The JSP page for the HelloUserWikExample contains conditional code that determines whether the application request was generated by a portlet. The JSP page then generates the appropriate type of HTML.

Note: The purpose of the HelloUserWikExample application is to show how you can use the APIs to access the shared session context. It is not intended to illustrate best programming practices.

The following steps were used to create the application:

  1. Create a directory structure for the application.

  2. Make deployment configurations available for local and remote services.

  3. Create a privileged user for the application to use in accessing the portal's remote session information.

  4. Create the Web application deployment descriptor (web.xml).

  5. Create the display page (app.jsp).

  6. Create the WAR file, and deploy and test the application.