代码之家  ›  专栏  ›  技术社区  ›  onigunn

springportletmvc-如何捕获映射异常

  •  0
  • onigunn  · 技术社区  · 15 年前

    有没有办法为我的springportlets提供一个默认状态,如果出现不可用的表达式,该状态将被解析?

    我收到这个例外

    10:24:53,187 ERROR [517: org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl] The portlet threw an exception
    javax.portlet.UnavailableException: No matching handler method found for portlet request: mode 'view', phase 'ACTION_PHASE', parameters map[[empty]]
        at org.springframework.web.portlet.mvc.annotation.AnnotationMethodHandlerAdapter$PortletHandlerMethodResolver.resolveHandlerMethod(AnnotationMethodHandlerAdapter.java:488)
        at org.springframework.web.portlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:354)
        at org.springframework.web.portlet.mvc.annotation.AnnotationMethodHandlerAdapter.doHandle(AnnotationMethodHandlerAdapter.java:345)
        at org.springframework.web.portlet.mvc.annotation.AnnotationMethodHandlerAdapter.handleAction(AnnotationMethodHandlerAdapter.java:280)
        at org.springframework.web.portlet.DispatcherPortlet.doActionService(DispatcherPortlet.java:646)
        at org.springframework.web.portlet.FrameworkPortlet.processRequest(FrameworkPortlet.java:519)
        at org.springframework.web.portlet.FrameworkPortlet.processAction(FrameworkPortlet.java:460)
    

    *-portlet.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
            xmlns:context="http://www.springframework.org/schema/context"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
            <context:annotation-config/>
            <!-- Controllers -->
            <bean id="portletController" class="de.nv.spring.portlets.PortletController"/>
    
            <!-- Handler Mappings -->
            <bean class="org.springframework.web.portlet.mvc.annotation.DefaultAnnotationHandlerMapping"/>
    </beans>
    
    2 回复  |  直到 15 年前
        1
  •  1
  •   heikkim    14 年前

    你有默认的渲染/动作方法吗?对于我来说,以下默认渲染方法有效:

    @RenderMapping(params="!render")
    public String defaultRender(RenderRequest req, RenderResponse res, Model model) throws PortalException, SystemException {
       // do something
    }