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

Step 2: Create the Portlet Deployment Descriptor

The portlet deployment descriptor is an XML file that provides all of the information that the portal Web application needs to deploy one or more portlets. Here is the portlet deployment descriptor for the FormExample portlet. The boxes contain explanatory comments. For more information, see Creating a Portlet Deployment Descriptor.


<?xml version="1.0" encoding="UTF-8"?>

The DOCTYPE statement must be present in the descriptor file in order for the portlet to run. However, the document type definition (DTD) does not need to be accessible at the URL that the statement specifies.

If you want to look at the portlet.dtd file, you can find it in the portal setup directory in the path Portal\WEB-INF. For example, if you used the default installation location on a Windows system, then the DTD is located under the following path: c:\Program Files\SAS\Web\Portal2.0.1\Portal\WEB-INF.

<!DOCTYPE portlets SYSTEM "http://www.sas.com/idp/portlet.dtd">

<portlets>

The local-portlet element assigns the name FormExample to the portlet. The name cannot contain spaces. The portlet identifier, which consists of the portlet path (defined in the portlet-path element) together with the portlet name, must be unique within the portal Web application.

  <local-portlet name="FormExample" title="Form Example" >
    <localized-resources locales="en" />
    <keywords>
      <keyword></keyword>
    </keywords>
The deployment element specifies that the portlet is to be available to the Public group. This means that all users will be able to search for this portlet and add it to their pages. Use all CAPS for PUBLIC.
    <deployment scope="group" autoDeploy="true"
	    userCanCreateMore="false">
	  <group>PUBLIC</group>
    </deployment>

Since no initializer class is specified, the FormExample portlet will use the default initializer JspPortletInitializer. This initializer requires a page name as a parameter. The FormExample has its own JSP page, called FormExample.jsp.

	
    <init-param>
      <param-name>display-page</param-name>
      <param-value>FormExample.jsp</param-value>
	</init-param>
The portlet-path element specifies the directory location in which the portlet is to be deployed. The portlet identifier, which consists of the portlet path together with the portlet name (defined in the local-portlet element), must be unique within the portal Web application.
	
  <portlet-path>/sas/portlets</portlet-path>
To provide its interactive functionality, the FormExample portlet has its own action class, called DisplayAction. The name of the class is specified in the type subelement of the portlet-action element.
	
  <portlet-actions>
    <portlet-action name="display" default="true">
        <type>com.sas.portal.portlets.formexample.DisplayAction</type>
      </portlet-action>
    </portlet-actions>
  </local-portlet>
</portlets>