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 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. <%@ 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.)
... currentProductID = portletRequest.getSettingValue(SettingType.User, "CoStoreProductID"); ...Portlet 2 - .NET
... Dim currentProductID As String currentProductID = portletRequest.GetSettingValue(SettingType.User, "CoStoreProductID") ...