代码改变世界

Jstl Foreach循环Property 'studno' not found on type java.lang.String

2014-05-07 11:08  暂时没想到  阅读(213)  评论(0)    收藏  举报

<c:forEach var="student" items="${sessionScope.students}" varStatus="status">
  <c:if test="${status.index % 2 == 0}">
    <tr style="background: #CFCFCF">

  </c:if>
  <td><c:out value="${student.studno}"/></td>
  <td><c:out value="${student.studname}"/></td>
  </tr>
</c:forEach>

 

这个错误犯了两次了,有必要记下来,foreach标签的items一定要是一个集合,写成items="students"(错误)是一个字符串,字符串当然没有你想要的属性