如何从Java控制器向jsp变量传递值
我的.jsp中有以下代码:如何从Java控制器向jsp变量传递值,java,jsp,spring-mvc,Java,Jsp,Spring Mvc,我的.jsp中有以下代码: <% for(int i=0; i <= 10; i++) { %> <TR> <td>${values[i][0]}</td> <td>${values[i][1]}<input type="button" width="60" value="EDIT"></td> <td>${values[i][2
<% for(int i=0; i <= 10; i++)
{ %>
<TR>
<td>${values[i][0]}</td>
<td>${values[i][1]}<input type="button" width="60" value="EDIT"></td>
<td>${values[i][2]}<input type="button" width="60" value="RESET"></td>
</TR>
<% } %>
如何执行此操作?检查EL表达式,
${values[I][0]}
这不正确
请尝试以下代码:
<c:forEach var="value" items="${values}">
<td>${value.name}</td> <!-- will be attributes of the object stored in controller -->
</c:forEach>
${value.name}
应该可以,您面临的问题是什么?我希望您在web.xml中有必要的名称空间设置。条目保持为空,但控制器的对象不是空的。什么是不正确的?这是正确的表达
<c:forEach var="value" items="${values}">
<td>${value.name}</td> <!-- will be attributes of the object stored in controller -->
</c:forEach>