我正在尝试将db表数据检索到表中,但我在
处收到语法错误<body>
<tr>
if(!resultset.next()) {
out.println("Sorry, could not find that publisher. ");
} else {
while(resultset.next())
{
<tr>
<td class="auto-style9"><%=resultset.getInt(1)%> </td>
<td class="auto-style10"><%=resultset.getString(2)%></td>
<td class="auto-style11"><%=resultset.getString(3)%></td>
<td class="auto-style11"><%=resultset.getString(4)%></td>
</tr>
}
}
%>
</table>
</body>
答案 0 :(得分:1)
您将html
代码与jsp
代码混合在一起。
应该是:
<%
if(!resultset.next()) {
out.println("Sorry, could not find that publisher. ");
} else {
while(resultset.next())
{
%>
<tr>
<td class="auto-style9"><%=resultset.getInt(1)%> </td>
<td class="auto-style10"><%=resultset.getString(2)%></td>
<td class="auto-style11"><%=resultset.getString(3)%></td>
<td class="auto-style11"><%=resultset.getString(4)%></td>
</tr>
<%
}
}
%>
</table>