<%@ page contentType="text/html;charset=GBK" %>
<%@ page import="java.sql.*"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>留言</title>
</head>

<jsp:useBean id="db" scope="session" class="myBean.DBConnection" />
<body>
<p><%
	String id = request.getParameter("id");
	if(id==null) {
		out.print("该留言不存在");
		return;
	}
	String sql = "select title,content from msg where id="+ id;
	ResultSet rs = db.execQuery(sql);
	if(!rs.next()){
		out.print("数据库库操作有误" +"<br><a href=\"msg.jsp\">返回</a>");
		return;
	}
%>
标题：<%=rs.getString("title")%><br>
内容：<%=rs.getString("content")%><br>
<hr>
<br>
<h3>以下是所有回复:</h3>
<%
	rs.close();
	sql = "select title, content from msg where pid=" +id;
	ResultSet rs2 = db.execQuery(sql);
	while(rs2.next()) {
%>
标题：<%=rs2.getString("title")%><br>
内容：<%=rs2.getString("content")%><br>
<hr>
<br>
<%
	}
%>
<a href=msg.jsp?pid=<%=id%>>回复</a>&nbsp;<a href="list_msg.jsp">返回</a>
</body>

</html>