警告: Parameters: Invalid chunk ignored.

今日写程序时遇到这么个(似曾相识)问题:

在页面(jsp)中使用了struts2的<s:select../>标记,保存的时候总是报这个错误:

Console打印Error
tag 'select', field 'list', name 'ClassA.propertyA': The requested list key 'XXXList' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location] at org.apache.struts2.components.Component.fieldError(Component.java:231) at org.apache.struts2.components.Component.findValue(Component.java:293) at org.apache.struts2.components.ListUIBean.evaluateExtraParams(ListUIBean.java:79) at org.apache.struts2.components.Select.evaluateExtraParams(Select.java:99) at org.apache.struts2.components.UIBean.evaluateParams(UIBean.java:780) at org.apache.struts2.components.UIBean.end(UIBean.java:481) at org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:43) at org.apache.jsp.WEB_002dINF.pages.cms.contributions.release_jsp._jspx_meth_s_005fselect_005f0(release_jsp.java:1915) at org.apache.jsp.WEB_002dINF.pages.cms.contributions.release_jsp._jspService(release_jsp.java:514) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:413) at
...

 

反复检查页面页面后发现原来是ClassA中有个名叫auditAt的属性是一个User类型的对象(也就是一个引用,很低级的错误),而页面中写了个:

 

<input type="hidden" name="ClassA.auditAt" value="${ClassA.auditAt.id}"/>

  

缺少了User类的id属性,加上id后改成:

 

<input type="hidden" name="ClassA.auditAt.id" value="${ClassA.auditAt.id}"/>

  

一切Ok~!

 

总结:struts2的标签很智能,但从某些程度上讲比较认死理,这个错误无法调试,因为在映射的时候就已经发生了错误,根本到不了action就挂了。所以如果你也遇到类似问题不妨先检查下页面,看是否漏掉了哪个子类的属性。

 

Btw,相信不少人都遇到这个问题了吧,错误不好gg啊,全是e文~~~

你可能感兴趣的:(java,apache,jsp,cms,servlet)