This content has been marked as final.
Show 1 reply
-
1. Re: Setting Portlet Preferences in Jboss Portal
piergiorgiolucidi Mar 3, 2009 11:01 AM (in response to dynamolalit)To manage preferences in your portlet you need to add preferences in your portlet.xml in this way:
<portlet> <portlet-name>YourPortlet</portlet-name> <portlet-class>org.yourcompany.portlet.content.YourPortlet</portlet-class> <supports> <mime-type>text/html</mime-type> <portlet-mode>VIEW</portlet-mode> </supports> <portlet-info> <title>Your Portlet Title</title> </portlet-info> <portlet-preferences> <preference> <name>numberContactPerPage</name> <value>10</value> </preference> </portlet-preferences> </portlet>
Then in your portlet you can use this snippet:public void processAction (ActionRequest request, ActionResponse actionResponse) throws PortletException, java.io.IOException { PortletPreferences pref = request.getPreferences(); pref.setValue("15",request.getParameter("numberContactPerPage")); pref.store(); actionResponse.setPortletMode(PortletMode.VIEW); actionResponse.setRenderParameters(request.getParameterMap()); }
Hope this helps.