AquaLogic User Interaction Development Guide

     Previous Next  Open TOC in new window   View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Creating a Portlet Preferences Page

To create a Portlet Preferences page, deploy the page to the remote server that hosts the portlet and enter the page URL in the Web Service editor.

The URL to the Portlet Preferences page is specified in the Web Service editor on the Preferences page. The base URL is defined by the associated Remote Server. All User settings required by the portlet must be entered by name in the Preference list on this page. If a setting is not entered in this list, it will not be available to the portlet. Portlet settings do not need to be entered.
Note: User settings are shared among all services, so you must use a unique setting name. For example, "Exchange55Password" is less likely to result in a name collision than "password".
The IDK provides interfaces to manipulate settings in the portal database. In the example code below, two portlets share the User setting CoStoreProductID. Note: The setting name must be entered in the Web Service editor for both portlets. All portlet files must be gatewayed.
The first portlet provides a form for the user to enter the product ID, and stores this information as a User setting. Portlet 1 - Java
<%@ page language="java" import="com.plumtree.remote.portlet.*,java.util.Date" %>

IPortletContext portletContext = PortletContextFactory.createPortletContext(request,
response); IPortletResponse portletResponse = portletContext.getResponse(); 
IPortletUser portletUser = portletContext.getUser();
IPortletRequest portletRequest = portletContext.getRequest();

// Get the incoming Product ID from the query string
String currProduct = request.getParameter("ID");

if (null == currProduct) 
  { 
  currProduct = ""; 
  }
portletResponse.setSettingValue(SettingType.User, "CoStoreProductID", 
sCurrProduct);
// Redirect to the Company Store Community
portletResponse.returnToPortal();
... 

Portlet 1 - .NET

...
Dim portletContext As IPortletContext
portletContext = PortletContextFactory.CreatePortletContext(Request, Response)

Dim portletRequest As IPortletRequest
portletRequest = PortletContext.GetRequest

Dim portletUser As IPortletUser
portletUser = PortletContext.GetUser

Dim portletResponse As IPortletResponse
portletResponse = PortletContext.GetResponse

portletResponse.SetSettingValue(SettingType.User, "CoStoreProductID",  Request.QueryString("ID"))
...

The second portlet checks for the User setting before building its display. (The portlet then retrieves the stored User setting from the ALI database and displays the product.)

Portlet 2 - Java
...
currentProductID = portletRequest.getSettingValue(SettingType.User, "CoStoreProductID");
... 
Portlet 2 - .NET
...
Dim currentProductID As String
currentProductID = portletRequest.GetSettingValue(SettingType.User, "CoStoreProductID")
...
User settings can also be entered on the User Configuration page, accessible from the My Account page in the portal. For details, see the portal online help.

  Back to Top      Previous Next