Editing Preferences is functionality available on many portlets in "my groundwork" tab. user can edit enter choices and select options to customize portlet according to needs.
These pages are generally suffixed with "XXXpref.jsp" and are simple JSP pages. Many pages use JQuery libraries like auto complete to achieve dynamic functionality. We need to include <%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%> This tag lib in page and use <form method="post" action="<portlet:actionURL/>"></form> tag to accommodate all the editing UI code inside it.
renderRequest.getAttribute("customPortletTitle") is used to show previous values of that fields on page.
When user click on "edit preferences" icon, doEdit() method of portlet class gets called. We actually call "request.setAttribute()" method in Baseportlet.java class and set required attributes in portlet request. Hence we need to provide appropriate parameters to "doEditPref()" method of Baseportlet.
When user saves preferences, we call "processAction()" method of portlet class. In this method, we call base class method of same name and actually save those preferences by using "PortletPreferences.store()" method. So we need to send appropriate parameters to this method.
Changes needs to be done in several "maps" that we are using to store actual preferences keys. At some places we are using "EditPrefsBean" class to Carrie those values.
Preferences are stored in jboss-portal database.
Preferences are generally accessed with several methods available in FacesUtils class like getPreference(String key). We can also specify some preferences and there default values in portlet.xml file in code, by using portlet-preferences tag.