4
回答
求教:struts2如何在action中接收来自页面的List<Map<String,String>>
利用AWS快速构建适用于生产的无服务器应用程序,免费试用12个月>>>   

如题,jsp页面如下

...
<form action="teMan.action" method="post">
  <input name="birdate[0]['id1']" value="2001-02-05" />
  <input name="birdate[0]['id2']" value="2301-02-05" />
  <input class="button" type="submit" value="Test" />
</form>
action代码如下
public class AddUAction {
	private List<Map<String,String>> birdate;
         // 省略get、set
         public String addU() {
	  System.out.println(birdate);
	  return "ok";
	}
...

提交即报错如下

exception javax.servlet.ServletException: Filter execution threw an exception org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:83) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) root cause java.lang.NoSuchMethodError: org.apache.struts2.interceptor.StrutsConversionErrorInterceptor.escape(Ljava/lang/Object;)Ljava/lang/String; org.apache.struts2.interceptor.StrutsConversionErrorInterceptor.getOverrideExpr(StrutsConversionErrorInterceptor.java:83) com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:105) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) ...

举报
luckythc
发帖于5年前 4回/2K+阅

以下是问题补充:

  • @luckythc :基本类型的List<String>或者Map<String,String>没问题,甚至自定义的List<Entity>或Map<String,Entity>也没问题,就是List<Map>这种组合不行 (5年前)
顶部