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); }
newZip=92691 RssXml=http://xml.weather.yahoo.com/forecastrss?p=33145
Sorry, wrong forum. Though for sure I clicked on JBoss Portal forum before posting this. Oh well.