遇到一个奇葩问题,jsp 文件一直报错,报错位置为下面代码中的第二生,即for循环的第一行
<c:if test="${not empty students}"> <c:forEach items="${students} " var="student"> <tr> <td>${student.studentID}</td> <td>${student.sclass }</td> <td>${student.studentName}</td> <td>${student.result }</td> </tr> </c:forEach> </c:if找了很久,也没能确定原因,最后将另处的正常jsp 中的for 拷过来,替换下面的代码就,没问题了,所以确定原因肯定在for 中,于是将循环体啥的,全部去除,发现还是报错,日了狗了。 于是出去转了下,回来突然想到曾经某位大神说过jsp 中不要加空格,于是注意到下面代码for 的items 中多一个空格……于是有了下面代码,测试,通过
<c:if test="${not empty students}"> <c:forEach items="${students}" var="student"> <tr> <td>${student.studentID}</td> <td>${student.sclass }</td> <td>${student.studentName}</td> <td>${student.result }</td> </tr> </c:forEach> </c:if