1.编写第一个页面
<html>
<head>
<title>第一个web文件</title>
</head>
<body>
<h2>欢迎学习web!</h2>
<div style="text-align: center">
<button type="button"><a href="Login.jsp">登录</a></button>
<button type="button"><a href="Zhuce.jsp">去注册</a></button>
</div>
</body>
</html>
效果:
![](https://img-blog.csdnimg.cn/img_convert/142c16257850085c3991a761cc6dbad1.png)
2.编写登录页面
<html>
<head>
<title>登录</title>
</head>
<body>
<div style="text-align: center">
<P>登录</P>
<form action="login" method="post">
账号:<input type="text" name="username" value=""> <br>
密码:<input type="password" name="password" value=""> <br>
<input type="submit" value="登录">
</form>
</div>
</body>
</html>
效果:
![](https://img-blog.csdnimg.cn/img_convert/451f98bdbe82113a7dac5399133d034d.png)
2.1登录的实体类
package com.han.servlet;
public class User {
private Integer uid;
private String username;
private String password;
private String phone;
private String address;
public User() {
}
public User(Integer uid, String username, String password, String phone, String address) {
this.uid = uid;
this.username = username;
this.password = password;
this.phone = phone;
this.address = address;
}
public Integer getUid() {
return uid;
}
public void setUid(Integer uid) {
this.uid = uid;
}