我想把数据库中的数据提取出来~并把它们放到相应的位置!
我可是没有获取到数据库中的数据~<%@page contentType="text/html;charset=gb2312"%>
<%@include file="common/conn.jsp"%>
<%@page import="java.sql.*"%>
<html>
<head><title>提出数据库中的信息</title></head>
<body>
<%
String sql ="select * from Info2 where id=?";
PreparedStatement stm =null;
ResultSet rs =null;
try
{
stm = conn.prepareStatement(sql);
stm.setString(1,name);
rs = stm.executeQuery();
}
catch(SQLException e)
{
e.printStackTrace();
}
%>
<%
while(rs.next())
{
String title = rs.getString(1);
String content = rs.getString(2);
String time = rs.getString(3);
%>
<table border="1" width="500px" height="600px"  cellspacing="0" cellpadding="0">
<tr>
<td valign="top" name="title"><%=title%><p name="content"><%=content%></p><p name="time"><%=time%></p></td>
<td valign="top">title<p>content</p></td>
</tr>
<tr>
<td valign="top">title<p>content</p></td>
<td valign="top">title<p>content</p></td>
</tr>
</table>
<%
}
rs.close();
stm.close();
conn.close();
%>
</body>
</html>