这是一个简单的 jsp 页面的 html,所有 <th>
标签是无效的位置。我正在遵循我正在尝试做的同一类型项目的指南,这也是该指南的方式......
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Doctors</title>
</head>
<body>
<div align="center">
<h1>Doctor List</h1>
<h3><a href="newDoctor">New Doctor</a></h3>
<table border="1">
<th>Id</th>
<th>Name</th>
<th>Email</th>
<th>Medical Degree</th>
<th>Education</th>
<th>Action</th>
<c:forEach var="doctor" items="${doctors}">
<tr>
<td>${doctor.id}</td>
<td>${doctor.lastName}, ${doctor.firstName}</td>
<td>${doctor.email}</td>
<td>${doctor.degree}</td>
<td>${doctor.education}</td>
<td>
<a href="editDoctor?id=${doctor.id}">Edit</a>
<a href="deleteDoctor?id=${doctor.id}">Delete</a>
</td>
</tr>
</c:forEach>
</table>
</div>
</body>
</html>
编辑:感谢您的快速回答
最佳答案
添加<tr>
标记并放置所有 <th>
介于两者之间。
像这样:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Doctors</title>
</head>
<body>
<div align="center">
<h1>Doctor List</h1>
<h3><a href="newDoctor">New Doctor</a></h3>
<table border="1">
<tr>
<th>Id</th>
<th>Name</th>
<th>Email</th>
<th>Medical Degree</th>
<th>Education</th>
<th>Action</th>
</tr>
<c:forEach var="doctor" items="${doctors}">
<tr>
<td>${doctor.id}</td>
<td>${doctor.lastName}, ${doctor.firstName}</td>
<td>${doctor.email}</td>
<td>${doctor.degree}</td>
<td>${doctor.education}</td>
<td>
<a href="editDoctor?id=${doctor.id}">Edit</a>
<a href="deleteDoctor?id=${doctor.id}">Delete</a>
</td>
</tr>
</c:forEach>
</table>
</div>
我希望这能解决这个问题。
关于html - <th> 标记的位置无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35414379/