第七周作业

public class person {
    private int uid;
    public int getUid() {
        return uid;
    }
    public void setUid(int uid) {
        this.uid = uid;
    }
    public String getUname() {
        return uname;
    }
    public void setUname(String uname) {
        this.uname = uname;
    }
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = password;
    }
    private String uname;
    private String password;
}

 
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<form action="login1.jsp" method="post">
    输入用户名:<input type="text"  id="registername" name="registername"><br>
    输入密码:<input type="password" id="registerpassword" name="registerpassword"><br>
    <input type="submit" value="注册">
    
</form>
</body>
</html>

     

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>注册收集</title>
</head>
<body>
     <% 
    person p = new person();
    String registername = request.getParameter("registername");
    p.setUname(registername);
    String registerpassword = request.getParameter("registerpassword");
    p.setPassword(registerpassword);
    
    RegisterDao rd=new RegisterDao();
    if(rd.add(p)>0){
        out.print("成功注册!"); 
    }else{
        out.print("注册失败,重试!"); 
    }
    
    %>
</body>
</html>

  

posted @ 2021-04-19 18:45  伏处  阅读(5)  评论(0编辑  收藏