3 Replies Latest reply on Jun 14, 2010 9:51 AM by brunovernay

    Portlet Preferences and serveResource method

      Hi --

      I'm trying to set the portlet preferences (portletHeight) through an AJAX call. I've opted to use the serveResource() method of the portlet. When I invoke the portlet function, serveResource(), through the AJAX call, the method does get executed. Within the serveResource() method, I then proceed to update my portlet preference as such:

      String portletHeight = request.getParameter("portletHeight");
      
      PortletPreferences portletPreference = request.getPreferences();
      portletPreference.setValue("portletHeight", portletHeight);
      portletPreference.store();


      I have defined the portlet preferences within the portal.xml file as such:

      ...
      
      <portlet-preferences>
       <preference>
       <name>portletHeight</name>
       <value>20</value>
       <read-only>false</read-only>
       </preference>
      </portlet-preferences>
      
      ...


      I read in the Portlet 2.0 Specification that one can modify the portlet preferences from within the serveResource() method as I've done. I couldn't find any working example that uses the serveResource( method to update portlet preferences.

      Does anyone know any reason why this would not work?

      Thanks a million ahead of time.