【发布时间】:2016-08-25 06:49:05
【问题描述】:
所以我有一个简单的 JSP 页面来显示这样的一些信息:
<%@ page import="db.DataManager"%>
<%@ page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
</head>
<%
DataManager dm = (DataManager) application.getAttribute("datamanager");
ArrayList<DataManager.Author> authors = dm.getAuthors();
%>
<body>
<table>
<tr>
<th></th>
<th>Name</th>
<th>Born</th>
<th>Died</th>
</tr>
<c:forEach var="author" items="${authors}">
<p>hello</p>/* not showing */
<tr>
<td>${authors.id}</td>
<td><a href="author.jsp">${author.name}</a></td>
<td>${author.born}</td>
<td>${author.died}</td>
</tr>
</c:forEach>
</table>
</body>
</html>
但不知何故,无论我在<c:forEach> 标签内放什么,它都不会显示在实际页面上(包括测试
标签)。我在WEB-INF/lib目录下有jstl 1.2的jar文件,所以不知道怎么回事。
【问题讨论】:
-
你在类路径中添加了jstl库吗?
-
可能是因为它在表内但不在 td 中的行之间