【问题标题】:Iterating and binding a List with JSTL使用 JSTL 迭代和绑定 List
【发布时间】:2014-11-14 14:32:52
【问题描述】:

我有一个坐标对象列表:

public class Coordinate {

    Integer id;
    Integer x;
    Integer y;

}

    <form:input path="myList[${elemIndex}].x"   size="5"    />
                                                                                               </c:forEach>

但我得到了这个错误

javax.servlet.jsp.JspException:org.springframework.beans.InvalidPropertyException:bean 类 [MyForm] 的无效属性 'myList[javax.servlet.jsp.jstl.core.LoopTagSupport$1Status@a6dfb0]':无效索引在属性路径'myList[javax.servlet.jsp.jstl.core.LoopTagSupport$1Status@a6dfb0]';嵌套异常是 java.lang.NumberFormatException:对于输入字符串:“javax.servlet.jsp.jstl.core.LoopTagSupport$1Status@a6dfb0”

【问题讨论】:

    标签: spring jsp spring-mvc jstl


    【解决方案1】:

    试试这样:

    <form:input path="myList[${elemIndex.index}].x" size="5" />
    

    假设elemIndex 是您在c:forEach 中设置的varStatus 属性。

    这里是an example

    【讨论】:

      猜你喜欢
      • 2016-02-09
      • 2013-02-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多