📄
字号:
范例User_addext.jsp源代码:
001<%@page contentType="text/html;charset=Gb2312"
002 import="Java.sql.*,Java.util.Date"%>
003<JSP:useBean id="pool" scope="application" class="com.PoolBean"/>
004<html>
005<head>
006 <title><h1>注册用户信息录入</h1></title>
007</head>
008<body>
009<%
010 String user_code,user_name,user_password;
011 String user_sex,user_birthday;
012 String user_year,user_email;
013 String user_month,user_day,user_duty;
014 String user_workplace,user_tel,user_address;
015 user_code = new
016 String(request.getParameter("user_code").getBytes("8859_1"));
017 user_name = new
018 String( request.getParameter("user_name").getBytes("8859_1"));
019 user_password = new
020 String( request.getParameter("user_password").getBytes("8859_1"));
021 user_sex = new
022 String( request.getParameter("user_sex").getBytes("8859_1"));
023 user_year =request.getParameter("user_year");
024 user_month =request.getParameter("user_month");
025 user_day =request.getParameter("user_day");
026 user_duty = new
027 String( request.getParameter("user_duty").getBytes("8859_1"));
028 user_workplace = new
029 String( request.getParameter("user_workplace").getBytes("8859_1"));
030 user_address = new
031 String( request.getParameter("user_address").getBytes("8859_1"));
032 user_tel = new
033 String( request.getParameter("user_tel").getBytes("8859_1"));
034 user_email = new
035 String( request.getParameter("user_email").getBytes("8859_1"));
036 user_birthday=user_year+"-"+user_month+"-"+user_day;
037 try
038 {
039 if (pool.getConnectionSize() == 0)
040 {
041 pool.initializePool();
042 }
043 Connection con = null;
044 Statement stmt = null;
045 con = pool.getConnection();
046 stmt= con.createStatement();
047 String strAdd = "insert into user(code,name,
048 password,sex,birthday,duty,workplace,address,telephone,email)
049 values('"+user_code+"','"+user_name+"','"+user_password+"',
050 '"+user_sex+"','"+user_birthday+"','"+user_duty+"',
051 '"+user_workplace+"','"+user_address+"','"+user_tel+"',
052 '"+user_email+"')";
053 out.println(strAdd);
054 stmt.executeUpdate(strAdd);
055 stmt.close();//关闭Statement对象
056 pool.releaseConnection(con);
057 response.sendRedirect("Login.jsp");
058
059 }
060 catch (Exception e)
061 {
062 out.println(e.getMessage());
063 }
64 %>
065</body>
066</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -