ALUIHelloWorld.jsp
<%@ page language="java" import="com.plumtree.remote.portlet.*,java.util.Date" %>
You refreshed at <b> <%= new Date().toString()%> </b> <br/>
<%
//get the idk
IPortletContext portletContext = PortletContextFactory.createPortletContext(request, response);
IPortletRequest portletRequest = portletContext.getRequest();
String settingKey = "PortletEntry";
String settingValue = portletRequest.getSettingValue(SettingType.Portlet, settingKey);
//if the entry has already been set, display it here
if (null != settingValue)
{
%>
<br/><b> Preference value is <%=settingValue%></b>!<br/>
<%
}
//form to enter the preference
%>
<P>Enter your preference - the value will be saved in a field named PortletEntry :
<form METHOD="post" ACTION="setPrefs.jsp" name="form1">
<input type="text" name="<%=settingKey%>">
<br/>
<input type="submit" name="Submit" value="Submit">
</form>
SetPrefs.JSP
<%@ page language="java" import="com.plumtree.remote.portlet.*" %>
<%
//set the cache control so we don't get a cached page
response.setHeader("Cache-control", "max-age=0");
//get the idk
IPortletContext portletContext = PortletContextFactory.createPortletContext(request, response);
//get IPortletResponse to set preferences and redirect back to the portal
IPortletResponse portletResponse = portletContext.getResponse();
//get the setting value from the servlet request
String settingKey = "PortletEntry";
String settingValue = request.getParameter(settingKey);
//set the setting value
portletResponse.setSettingValue(SettingType.Portlet, settingKey, settingValue);
//redirect back to the portal
portletResponse.returnToPortal();
%>






