右键WebContent,新建jsp.file
regist.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<style type="text/css">
span{
color:red ;
}
</style>
</head>
<body>
<h1>欢迎注册</h1>
<form action="regist" method="post">
用户名称:<input type="text" name="username"/><span>${regist_msg }</span>
<br/>
用户密码:<input type="password" name="password"/>
<br/>
确认密码:<input type="password" name="repassword"/>
<br/>
<input type="submit" value="注册"/>
</form>
</body>
</html>
新建RegistServlet.java
package com.atguigu.login.servlet;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.atguigu.login.beans.User;
import com.atguigu.login.dao.UserDao;
import com.atguigu.login.dao.UserDaoImpl;
public class