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: Interactive Form Portlet (FormExample)

The sample portlet called FormExample is an interactive portlet. It accepts free-form input from the user, as shown here:

FormExample portlet screen capture with user input

When the user clicks Submit Form, the portlet displays the entered text back to the user, as shown here:

FormExample portlet screen capture with text displayed back to the user

FormExample is a local portlet that runs inside the portlet container. It was developed using a JavaBean, which places values in the PortletContext object so that the values are available to the JSP page. The HttpServletRequest or HttpSession object could be used for this purpose. However, the PortletContext object is unique to the portlet and is not shared with other processes. Therefore, using it avoids collisions that could cause attribute values to be overwritten.

The following steps were used to create the FormExample portlet. Click on each step to display details.

  1. Create a directory structure for the portlet.

  2. Create the portlet deployment descriptor (portlet.xml).

  3. Create the display page (FormExample.jsp).

  4. Create the action class (DisplayAction.class).

  5. Create the bean.

  6. Create the PAR file, and deploy and test the portlet.