[jboss-user] [JBoss Portal] - Re: Setting Portlet Preferences in Jboss Portal

piergiorgiolucidi do-not-reply at jboss.com
Tue Mar 3 11:01:54 EST 2009


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.

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4214599#4214599

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4214599



More information about the jboss-user mailing list