1 Reply Latest reply on Jul 19, 2006 4:32 PM by peterj

    Portlet preferences not persisted

    peterj

      I am trying to update the portlet preferences within my code, but the preferences are not being persisted. I have based my code on what I found in the WeatherPortlet. I even added debugging to the WeatherPortlet to see how it was doing things. Here is the code:

      public void processAction(ActionRequest request, ActionResponse response) throws PortletException {
       String newZip = request.getParameter("newzip");
       log.debug("newZip=" + newZip);
       if(null != newZip) {
       PortletPreferences prefs = request.getPreferences();
       try {
       prefs.setValue("RssXml", RSS_URL_PREFIX + newZip);
       prefs.store();
       String xxx = prefs.getValue("RssXml", null);
       log.debug("RssXml=" + xxx);
       } catch(Exception e) {
       e.printStackTrace();
       }
       }
       response.setRenderParameter("newzip", RSS_URL_PREFIX + newZip);
       response.setPortletMode(PortletMode.VIEW);
      }


      And here is what shows up on the log file (sans leading junk):

      newZip=92691
      RssXml=http://xml.weather.yahoo.com/forecastrss?p=33145


      The 33145 zip is what is configured in portal.xml. So immediately after setting the preference and storing it, it disappears and reverts back to the original setting.

      Should I open a JIRA issue?

      Using: JBoss 4.0.4-GA, JBoss Portal 2.4.0-CR1, JDK 5.0

      Standard disclaimer: I searched through the forum, JIRA, and even did a general google and could not find anything on this topic.