jsp8
Posted akaxuan
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了jsp8相关的知识,希望对你有一定的参考价值。
<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的主要内容,如果未能解决你的问题,请参考以下文章