@RequestMapping在渲染方法中有2个参数

时间:2012-09-28 12:44:06

标签: java spring spring-mvc annotations

我正在尝试在同一个控制器中管理2个动作,一切都没问题!唯一的是doRender方法。 我正在尝试对两个动作使用相同的渲染方法,如下所示:

private static final String ACTION_ALTA_TIPO_FACTURA = "action=" + ServletContextKeys.SC_ALTA_TIPO_FACTURA;
private static final String ACTION_BAJA_TIPO_FACTURA = "action=" + ServletContextKeys.SC_BAJA_TIPO_FACTURA;

@RequestMapping(params = {ACTION_BAJA_TIPO_FACTURA,ACTION_ALTA_TIPO_FACTURA})
public final String doRender(@ModelAttribute(value = "Factura") Factura justfactura, Errors errors, RenderRequest renderrequest) {
        ...
}

但显然这不起作用。这就是服务器日志所说的内容:

[#|2012-09-28T11:54:05.723+0000|SEVERE|sun-appserver2.1|debug.com.sun.portal.portletcontainer.impl|_ThreadID=21;_ThreadName=httpSSLWorkerThread-8080-0;sifo3economicoweb|SifoIIIweb|SifoIIIweb_WAR_sifo3economicoweb_INSTANCE_fu7M;org.springframework.web.portlet.NoHandlerFoundException: No matching handler method found for portlet request: mode 'view', phase 'RENDER_PHASE', parameters map['action' -> array<String>['altaFactura'], 'altaFactura_tabs' -> array<String>['factura']];_RequestID=7ffe667a-23c0-4599-b1f6-0a53d11a5cb7;|PSPL_PCCSPCPCI0001 : Exception thrown from EntityID: sifo3economicoweb|SifoIIIweb|SifoIIIweb_WAR_sifo3economicoweb_INSTANCE_fu7M, cause: org.springframework.web.portlet.NoHandlerFoundException: No matching handler method found for portlet request: mode 'view', phase 'RENDER_PHASE', parameters map['action' -> array<String>['altaFactura'], 'altaFactura_tabs' -> array<String>['factura']]|#]

请帮忙吗?

2 个答案:

答案 0 :(得分:1)

执行此操作的唯一方法是定义多个方法。

答案 1 :(得分:1)

您可以使用参数per方法映射。看到我的问题和答案:

org.springframework.web.servlet.mvc.method.annotation。* 包中的类归档...

相关问题