【发布时间】:2012-02-08 11:18:01
【问题描述】:
下面是我在 index.jsp 中使用 jstl 1.2 的代码。
<%@ taglib prefix = "c" uri="http://java.sun.com/jstl/core"%>
<% String[] setName = {"Hello", "you", "are", "using", "jstl", "in", "jsp"};
request.setAttribute("getName", setName);
%>
<html>
<body>
<table>
<tr><td>Print</td></tr>
<c:forEach var="itemName" items="#{getName}" >
<tr>
<td>${itemName}</td>
</tr>
</c:forEach>
</table>
</body>
</html>
我期待的输出如下
Print
Hello
you
are
using
jstl
in
jsp
但下面是我得到的
Print
#{name}
请告诉我我在哪里失踪
以下是我在 WEB-INF/lib 文件夹中的唯一 jar 文件 jstl-1.2.jar
提前致谢
法希姆
注意:添加Java和JSP标签作为了解Java和JSP的人可能也知道JSTL...
【问题讨论】:
-
请注意当我在 JSF 项目中运行相同的代码时,代码正在运行并显示我想要的输出。现在我在 Ecpise 中的 Web 动态项目下做同样的事情 我错过了任何 jar 文件吗??
-
好吧好吧,我有问题了...我应该使用
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>而不是<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>