码迷,mamicode.com
首页 > Web开发 > 详细

jsp8

时间:2020-07-19 11:54:02      阅读:94      评论:0      收藏:0      [点我收藏+]

标签:ref   dstat   cal   man   val   正文   request   cti   cte   

<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

标签:ref   dstat   cal   man   val   正文   request   cti   cte   

原文地址:https://www.cnblogs.com/akaxuan/p/13338624.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!