zman
Feb 13th, 2006, 06:34 AM
Hi
I am having problems with trying to add an init-param to portlet.xml and access it in a controller. Below is my portlet.xml
<portlet>
<portlet-name>Search</portlet-name> <portlet-class>org.springframework.web.portlet.DispatcherPortlet</portlet-class>
<init-param>
<name>contextConfigLocation</name>
<value>/WEB-INF/context/portlet/search.xml</value>
</init-param>
<init-param>
<name>refreshResults</name>
<value>5000</value>
</init-param>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>view</portlet-mode>
</supports>
<portlet-info>
<title>Search</title>
</portlet-info>
</portlet>
</portlet-app>
and my controller
public class SummaryController extends AbstractController implements PortletConfigAware {
public void setPortletConfig(PortletConfig portletConfig)
{
this.portletConfig = portletConfig;
}
protected ModelAndView handleRenderRequestInternal(RenderRequest request, RenderResponse response) throws Exception
{
// readRefreshInterval(request);
try { System.err.println("HERE1="+portletConfig.getInitParameter("refreshResults"));
} catch (Exception e) {}
return new ModelAndView("summary", "model",model);
}
}
The portlet fails to render and the error I am getting is:
org.springframework.beans.NotWritablePropertyExcep tion: Invalid property 'refreshResults' of bean class [org.springframework.web.portlet.DispatcherPortlet]: Bean property 'refreshResults' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
Can you please help. Thanks
I am having problems with trying to add an init-param to portlet.xml and access it in a controller. Below is my portlet.xml
<portlet>
<portlet-name>Search</portlet-name> <portlet-class>org.springframework.web.portlet.DispatcherPortlet</portlet-class>
<init-param>
<name>contextConfigLocation</name>
<value>/WEB-INF/context/portlet/search.xml</value>
</init-param>
<init-param>
<name>refreshResults</name>
<value>5000</value>
</init-param>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>view</portlet-mode>
</supports>
<portlet-info>
<title>Search</title>
</portlet-info>
</portlet>
</portlet-app>
and my controller
public class SummaryController extends AbstractController implements PortletConfigAware {
public void setPortletConfig(PortletConfig portletConfig)
{
this.portletConfig = portletConfig;
}
protected ModelAndView handleRenderRequestInternal(RenderRequest request, RenderResponse response) throws Exception
{
// readRefreshInterval(request);
try { System.err.println("HERE1="+portletConfig.getInitParameter("refreshResults"));
} catch (Exception e) {}
return new ModelAndView("summary", "model",model);
}
}
The portlet fails to render and the error I am getting is:
org.springframework.beans.NotWritablePropertyExcep tion: Invalid property 'refreshResults' of bean class [org.springframework.web.portlet.DispatcherPortlet]: Bean property 'refreshResults' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
Can you please help. Thanks