第七次
1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 2 3 4 <form action="dologin.jsp" method="post"> 5 用户名:<input id="username" type="text" name="username"/><br/> 6 密码:<input id="password" type="password" name="password"/><br/> 7 <%-- 验证码:<input type="text" name="inputVcode"/><img src="/WebProject_war_exploded/createCode"><br/>--%> 8 <input type="submit" value="注册"> 9 </form> 10 11 12 <%@ page import="com.bean.lty.UserBean" %> 13 <%@ page import="com.dao.lty.Dao" %> 14 <%@ page contentType="text/html;charset=UTF-8" language="java" %> 15 <html> 16 <head> 17 <title>Title</title> 18 </head> 19 <body> 20 21 <% 22 UserBean userBean = new UserBean(); 23 String username = request.getParameter("username"); 24 String password = request.getParameter("password"); 25 userBean.setUname(username); 26 userBean.setUpassword(password); 27 Dao dao = new Dao(); 28 int i = dao.UesrRegister(userBean); 29 if(i > 0){ 30 HttpSession session1 = request.getSession(); 31 session1.setAttribute("username",username); 32 session1.setAttribute("password",password); 33 request.getRequestDispatcher("ok.jsp").forward(request,response); 34 }else{ 35 response.sendRedirect("error.jsp"); 36 } 37 38 %> 39 40 </body> 41 </html> 42 43 44 45 <%@page import="com.ee.dao.UserDao"%> 46 <%@page import="com.ee.bean.User"%> 47 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 48 <% 49 User u = new User(); 50 51 String uname = request.getParameter("name"); 52 u.setUname(uname); 53 String upwd = request.getParameter("password");