【问题标题】:@RequestMapping with 2 params in render method@RequestMapping 在渲染方法中有 2 个参数
【发布时间】:2012-09-28 12:44:05
【问题描述】:

我正在尝试在同一个控制器中管理 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']]|#]

有什么帮助吗??

【问题讨论】:

标签: java spring spring-mvc annotations


【解决方案1】:

您可以使用每个方法映射的参数。看我的问答:

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

【讨论】:

    【解决方案2】:

    做到这一点的唯一方法是定义多个方法。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-03-12
      • 1970-01-01
      • 1970-01-01
      • 2012-06-22
      • 2019-10-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多