使用ParameterHandlerMapping时,找不到请求错误的处理程序

时间:2012-03-28 09:41:35

标签: spring-mvc liferay portlet

我是使用spring mvc on liferay进行portlet开发的新手。我正在为我的项目做POC。 在我的jsp页面中,我将请求发送到控制器,如下所示: -

<portlet:renderURL var="myRenderURL">
    <portlet:param name="action" value="accounts"/>
</portlet:renderURL>

目前我想编写仅使用控制器即VIEW模式查看页面的功能。 现在,当我使用PortletModeHandlerMapping映射控制器时,它可以正常工作,并且请求会按预期进入控制器。以下是代码段: -

**<bean id="portletModeHandlerMapping"
          class="org.springframework.web.portlet.handler.PortletModeHandlerMapping">
    <property name="portletModeMap">
        <map>
            <entry key="view" value-ref="partyAccountsSearchController" />
        </map>
    </property>
</bean>**

但是当我想使用ParameterHandlerMapping来实现相同的功能时。我收到以下错误: -

07:46:16,704 WARN  [PageNotFound:1010] No mapping found for current request in DispatcherPortlet with name 'LiferaySpringMVCPortlet', mode 'view', phase 'RENDER_PHASE', session '216338AB54AAF5E16EE373D9B97E640A', user 'null
07:46:16,704 ERROR [DispatcherPortlet:559] Could not complete request
javax.portlet.UnavailableException: No handler found for request
        at org.springframework.web.portlet.DispatcherPortlet.noHandlerFound(DispatcherPortlet.java:1017)
        at org.springframework.web.portlet.DispatcherPortlet.doRenderService(DispatcherPortlet.java:706)
        at org.springframework.web.portlet.FrameworkPortlet.processRequest(FrameworkPortlet.java:522)
        at org.springframework.web.portlet.FrameworkPortlet.doDispatch(FrameworkPortlet.java:470)
        at javax.portlet.GenericPortlet.render(GenericPortlet.java:233)
        at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:101)
        at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:64)
        at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:92)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
        at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:551)
        at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:488)
        at com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:638)
        at com.liferay.portlet.InvokerPortletImpl.invokeRender(InvokerPortletImpl.java:723)
        at com.liferay.portlet.InvokerPortletImpl.render(InvokerPortletImpl.java:425)
        at org.apache.jsp.html.portal.render_005fportlet_jsp._jspService(Unknown Source)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
        at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:551)
        at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:488)
        at com.liferay.portal.util.PortalImpl.renderPortlet(PortalImpl.java:3740)
        at com.liferay.portal.util.PortalUtil.renderPortlet(PortalUtil.java:1180)
        at com.liferay.portlet.layoutconfiguration.util.RuntimePortletUtil.processPortlet(RuntimePortletUtil.java:160)
        at com.liferay.portlet.layoutconfiguration.util.RuntimePortletUtil.processPortlet(RuntimePortletUtil.java:94)
        at com.liferay.portlet.layoutconfiguration.util.RuntimePortletUtil.processTemplate(RuntimePortletUtil.java:256)
        at com.liferay.portlet.layoutconfiguration.util.RuntimePortletUtil.processTemplate(RuntimePortletUtil.java:181)

以下是我为将请求映射到ParameterHandlerMapping而编写的代码片段: -

**<bean id="parameterHandlerMapping"
class="org.springframework.web.portlet.handler.ParameterHandlerMapping">
    <property name="parameterMap">
        <map>
            <entry key="accounts" value-ref="partyAccountsController" />
        </map>
    </property>
</bean>**

现在这里发生了一件特别的事情,如果我将请求映射到ParameterHandlerMapping中的defaultHandler,它就可以了。即添加

**<property name="defaultHandler" value="partyAccountsController"/>**

在parameterHandlerMapping bean中。

我不确定在配置ParameterHandlerMapping时是否遗漏了某些内容。

任何人都可以在配置ParameterHandlerMapping时知道如何解决这个问题。

任何帮助都将得到帮助。

感谢。

此致 -Nayan Parikh

0 个答案:

没有答案