<body>
<%
request.setCharacterEncoding("utf-8");
String uname = (String) session.getAttribute("uname");
session.setAttribute("uname", uname);
Connection conn = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
Class.forName("com.mysql.jdbc.Driver");
//加载驱动
String url = "jdbc:mysql://localhost:3306/users";
String user = "root";
String password = "admin";
conn = DriverManager.getConnection(url, user, password);
// 连接对象
//conn = BaseDao.getConnection();
%>
<form action="insert.jsp" name="huifu" method="post">
sendto :<input type="text" name="sendtoid"><br> <br>
标题:<input type="text" name="ctitle"><br> <br>
正文:<input type="text" name="ccontent"><br>
<br>
<input type="submit" value="发送">
<a href="main.jsp">返回</a>
</form>
<%
} catch (Exception e) {
e.printStackTrace();
} finally {
//BaseDao.closeAll(conn, ps, rs);
try {
if (rs != null) {
rs.close();
}
} finally {
try {
if (ps != null) {
ps.close();
}
} finally {
if (conn != null) {
conn.close();
}
}
}
}
%>
</body>
jsp8