暴躁的田

导航

第七周

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 on 2021-04-19 17:12  田智源  阅读(31)  评论(0编辑  收藏  举报