1

如果我不使用 portletModeParameterHandlerMapping,我想知道是否有办法模拟 parameterMappingInterceptor 行为。当然,我使用的是带注释的方法。我试图像这样定义我的 portlet.xml:

<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:webflow="http://www.springframework.org/schema/webflow-config"
   xmlns:dwr="http://www.directwebremoting.org/schema/spring-dwr"
   xmlns:context="http://www.springframework.org/schema/context"
   xsi:schemaLocation="
        http://www.springframework.org/schema/beans 
        http://www.springframework.org/schema/beans/spring-beans-3.1.xsd 
        http://www.directwebremoting.org/schema/spring-dwr 
        http://www.directwebremoting.org/schema/spring-dwr-2.0.xsd        
        http://www.springframework.org/schema/webflow-config 
        http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.0.xsd        
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context-3.1.xsd">

<context:component-scan base-package="es.xunta.formacion.sifo3.economico.web.controllers"/>

<bean id="parameterMappingInterceptor" class="org.springframework.web.portlet.handler.ParameterMappingInterceptor"/>  

</beans>

但显然,这根本不起作用,我仍然需要在渲染阶段设置动作参数,以访问渲染方法:

@RequestMapping(params = "action=myAction")
public final void doAction(@ModelAttribute(value = "myAttribute") MyBean myBean, Errors errors, ActionRequest actionrequest, ActionResponse actionresponse) {
validateBean(escrituraBean, errors);
//..
actionresponse.setRenderParameter("action", actionrequest.getParameter("myAction"));
}

@RequestMapping(params = "action=myAction")
public final String doRender(ModelMap model, RenderRequest renderrequest) {
//..
}

编辑:我也试过用这个来配置xml:

<bean id="annotationMapper" class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
<property name="interceptors">
    <list>
                <bean id="parameterMappingInterceptor" class="org.springframework.web.portlet.handler.ParameterMappingInterceptor"/>  
    </list>
</property>
</bean> 

获取此异常:

 Interceptor type not supported: org.springframework.web.portlet.handler.ParameterMappingInterceptor
4

0 回答 0