Portlet Preferences
PortletPreferences
The JSR-168 Portlet Preferences API can be used to manage simple String-based preferences for a portlet. Preferences saved via Config mode will be set for all instances of that uPortal portlet definition. Preferences saved via Edit or View modes will be instance-specific.
Querying portlet preferences
Preferences may be queried during either a RenderRequest or ActionRequest.
PortletPreferences preferences = actionRequest.getPreferences(); String myPreferences = preferences.getValue("preferenceName", "default");
Saving portlet preferences
Preferences may only be saved during an ActionRequest.
PortletPreferences preferences = actionRequest.getPreferences(); preferences.setValue("preferenceName", "preferenceValue"); preferences.store();
Choosing a preference persistence mechanism
PortletPreferences
PROS |
Cons |
---|---|
|
|
Custom Preferences (Database, webservice, etc.)
PROS |
Cons |
---|---|
|
|