用户表:  uid (主键,自动增长)   uname  upwd
使用分层实现注册。(必做)
使用分层实现登录。(选做
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
  <head>
    <title>$Title$</title>
  </head>
  <body>
  <form name="" method="post" action="control.jsp" >
    <table>
      <tr>
        <td>用户名: </td>
        <td> <input type="text" name="uname"></td>
      </tr>
      <tr>
        <td>请输入登录密码:</td>
        <td><input type="password" name="upwd" ></td>
      </tr>
      <tr>
        <td colspan="2"><input type="submit" value="注册">    <input type="submit" value="登录"></td>
      </tr>
    </table>
  </form>

  </body>
</html>
<%@ page import="com.gd.dao.EightDao" %>
<%@ page import="com.gd.bean.EightBean" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>

</head>
<body>
<%                      
    EightBean s = new EightBean();
    String uname =  request.getParameter("uname");
    s.setUname(uname);              //(将用户名和密码打包)
    String upwd = request.getParameter("upwd");
    s.setUpwd(upwd);

    System.out.println(s);
    EightDao dao = new EightDao();
    int result =  dao.addUser(s);
    if (result > 0 ){
        response.sendRedirect("success.jsp");
    }


%>
</body>
</html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
   《 注册成功》
</body>
</html>
package com.gd.bean;

public class EightBean {
    private int sid;
    private String uname;
    private String upwd;
    //访问器

    public int getSid() {
        return sid;
    }

    public void setSid(int sid) {
        this.sid = sid;
    }

    public String getUname() {
        return uname;
    }

    public void setUname(String uname) {
        this.uname = uname;
    }

    public String getUpwd() {
        return upwd;
    }

    public void setUpwd(String upwd) {
        this.upwd = upwd;
    }
    //构造方法
                //空参构造方法
    public EightBean() {
    }
            //有参构造方法

    public EightBean(int sid, String uname, String upwd) {
        this.sid = sid;
        this.uname = uname;
        this.upwd = upwd;
    }

    @Override
    public String toString() {
        return "EightBean{" +
                "sid=" + sid +
                ", uname='" + uname + '\'' +
                ", upwd='" + upwd + '\'' +
                '}';
    }
}
package com.gd.bean;

public class EightBean {
    private int sid;
    private String uname;
    private String upwd;
    //访问器

    public int getSid() {
        return sid;
    }

    public void setSid(int sid) {
        this.sid = sid;
    }

    public String getUname() {
        return uname;
    }

    public void setUname(String uname) {
        this.uname = uname;
    }

    public String getUpwd() {
        return upwd;
    }

    public void setUpwd(String upwd) {
        this.upwd = upwd;
    }
    //构造方法
                //空参构造方法
    public EightBean() {
    }
            //有参构造方法

    public EightBean(int sid, String uname, String upwd) {
        this.sid = sid;
        this.uname = uname;
        this.upwd = upwd;
    }

    @Override
    public String toString() {
        return "EightBean{" +
                "sid=" + sid +
                ", uname='" + uname + '\'' +
                ", upwd='" + upwd + '\'' +
                '}';
    }
}