%@ page session="false" %>
<%@ taglib uri='/WEB-INF/tld/portlet.tld' prefix='portlet'%>
<%@ page import="javax.portlet.*"%>
<%@ page import="java.util.*"%>
Testing PortletPreferences (2)...
Testing permanence of values:
<%
boolean allOk = false;
PortletPreferences preferences = renderRequest.getPreferences();
if (preferences.getValue("TEST_PERMANENCE", "Default").equals("permanent"))
allOk = true;
if (allOk) { out.print("passed."); }
else { out.print("failed."); }
%>
Testing value after reset AND store:
<%
allOk = true;
if (!preferences.getValue("TEST_RESET_KEY", "Default").equals("Default"))
allOk = false;
if (allOk) { out.print("passed."); }
else { out.print("failed."); }
%>
Testing automatic reset() after every render():
<%
allOk = true;
if (preferences.getValue("TEST_RESET_2", "Default").equals("success"))
allOk = false;
if (allOk) { out.print("passed."); }
else { out.print("failed."); }
%>
Testing null values:
<%
allOk = true;
if (preferences.getValue("TEST_NULL_VALUE", "Default") != null )
allOk = false;
if (preferences.getValue("TEST_NULL_VALUES", "Default") != null )
allOk = false;
if (preferences.getValues("TEST_NULL_VALUES", new String[]{"Default"}) != null )
allOk = false;
if (allOk) { out.print("passed."); }
else { out.print("failed."); }
%>
Testing PreferencesValidator
Setting unvalid preference value.
<%
String result = preferences.getValue("VALIDATION_TEST_KEY", "No test results available.");
out.print("
" + result + "
");
%>
<%
PortletURL url = renderResponse.createActionURL();
url.setParameter("checkPreferences","TidyUp");
url.setParameter("jspNameTransfer","test9.jsp");
%>