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

上一篇:Vue(小案例_vue+axios仿手机app)_Vuex优化购物车功能


下一篇:老男孩Python全栈学习 S9 日常作业 009