我經歷了與JSTL和arrayList相關的所有帖子,仍然找不到解決方案。<c:foreach>不被識別! 。 JSP中的ArrayList迭代
我一直在嘗試使用taglib在jsp文件上迭代ArrayList。 我在我的構建路徑中包含了最新的jstl 1.2 jar。 已經正確配置了taglib。
但仍得到一個錯誤盈它採用
<c:forEach>
標記線。 它說
<c:foreach>not recognized!,
是它顯示在一個的forEach 'E' 的錯誤!
請在下面找到我的代碼。
控制器代碼:
List<String> rolesList = new ArrayList<String>();
rolesList.add(ga.getAuthority());
JSP代碼:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<select>
<c:forEach items="${rolesList}" var="role">
<option>${role}</option>
</c:forEach>
</select>
您正在使用哪個服務器?這在舊服務器版本中不起作用。 – 2012-04-18 05:51:09
閱讀本http://www.coderanch.com/how-to/java/JstlTagLibDefinitions – 2012-04-18 06:11:24
我使用Tomcat 7 @HardikMishra:我添加的jar的兩個新版本在該鏈接中提到。 Does not'seem to solve the problem – Napster 2012-04-18 06:33:03