1.登录界面HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<!-- 设置该文件的对应路径为该工程路径,可以不用设置.注意路径可能会不同 -->
<base href="/servlet_mvn_jd2007/">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<form action="login.do" method="post">
用户名:<input type="text" name="username"><br/>
密 码:<input type="password" name="password"><br/>
<input type="submit" value="提交">
</form>
</body>
</html>
2.添加User类
package servlet_user;
import java.util.Date;
public class User {
private String name;
private String password;
private int age;
private Date birth;
public User() {
super();
}
public User(String name, String password, int age, Date birth) {
super();
this.name = name;
this.password = password;
this.age = age;
this.birth = birth;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public int g