Compare commits
No commits in common. 'main' and 'master' have entirely different histories.
@ -0,0 +1,62 @@
|
||||
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class ApplicantBean {
|
||||
private int applicant_id;
|
||||
private String applicant_email;
|
||||
private String applicant_pwd;
|
||||
private Date applicant_date;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ApplicantBean{" +
|
||||
"applicant_id=" + applicant_id +
|
||||
", applicant_email='" + applicant_email + '\'' +
|
||||
", applicant_pwd='" + applicant_pwd + '\'' +
|
||||
", applicant_date=" + applicant_date +
|
||||
'}';
|
||||
}
|
||||
|
||||
public ApplicantBean() {
|
||||
}
|
||||
|
||||
public int getApplicant_id() {
|
||||
return applicant_id;
|
||||
}
|
||||
|
||||
public void setApplicant_id(int applicant_id) {
|
||||
this.applicant_id = applicant_id;
|
||||
}
|
||||
|
||||
public String getApplicant_email() {
|
||||
return applicant_email;
|
||||
}
|
||||
|
||||
public void setApplicant_email(String applicant_email) {
|
||||
this.applicant_email = applicant_email;
|
||||
}
|
||||
|
||||
public String getApplicant_pwd() {
|
||||
return applicant_pwd;
|
||||
}
|
||||
|
||||
public void setApplicant_pwd(String applicant_pwd) {
|
||||
this.applicant_pwd = applicant_pwd;
|
||||
}
|
||||
|
||||
public Date getApplicant_date() {
|
||||
return applicant_date;
|
||||
}
|
||||
|
||||
public void setApplicant_date(Date applicant_date) {
|
||||
this.applicant_date = applicant_date;
|
||||
}
|
||||
|
||||
public ApplicantBean(int applicant_id, String applicant_email, String applicant_pwd, Date applicant_date) {
|
||||
this.applicant_id = applicant_id;
|
||||
this.applicant_email = applicant_email;
|
||||
this.applicant_pwd = applicant_pwd;
|
||||
this.applicant_date = applicant_date;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
|
||||
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.*;
|
||||
import javax.servlet.annotation.*;
|
||||
import java.io.IOException;
|
||||
|
||||
@WebServlet(name = "ApplicantLogoutServlet", value = "/ApplicantLogoutServlet")
|
||||
public class ApplicantLogoutServlet extends HttpServlet {
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||
//退出登录清空session信息
|
||||
request.getSession().invalidate();
|
||||
//退出后重定向到首页
|
||||
response.sendRedirect("index.jsp");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.*;
|
||||
import javax.servlet.annotation.*;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
|
||||
|
||||
@WebServlet("/ApplicantRegisterServlet")
|
||||
public class ApplicantRegisterServlet extends HttpServlet {
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||
//设置请求和响应编码
|
||||
request.setCharacterEncoding("UTF-8");
|
||||
response.setContentType("text/html;charset=UTF-8");
|
||||
PrintWriter out = response.getWriter();
|
||||
|
||||
//获取请求参数
|
||||
String email = request.getParameter("email");
|
||||
String pwd = request.getParameter("pwd");
|
||||
|
||||
//邮箱唯一性:注册使用的邮箱不能重复
|
||||
ApplicantDao appDao = new ApplicantDao();
|
||||
Boolean flag = appDao.isExistEmail(email);
|
||||
if (flag){
|
||||
out.println("<script type='text/javascript'>");
|
||||
out.println("alert('邮箱已被注册,请重新输入');");
|
||||
out.println("window.location = 'register.jsp'");
|
||||
out.println("</script>");
|
||||
}else {
|
||||
appDao.insertEmail(email,pwd);
|
||||
response.sendRedirect("login.jsp");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
|
||||
<script type="text/javascript">
|
||||
function validata(){
|
||||
var name = document.getElementById("Login_name");
|
||||
var pwd = document.getElementById("Login_pwd");
|
||||
|
||||
if(name.value == ""){
|
||||
alert("请输入邮箱账号!");
|
||||
name.focus();
|
||||
return false;
|
||||
}
|
||||
if(pwd.value == ""){
|
||||
alert("请输入登录密码!");
|
||||
pwd.focus();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<body>
|
||||
<iframe src="top.jsp" width="100%" height="100" scrolling="no" frameborder="0" ></iframe>
|
||||
<div class="content">
|
||||
<div class="page_name">登陆</div>
|
||||
<div class="login_content">
|
||||
<form action="/ApplicantLoginServlet" method="post" onsubmit="return validata()">
|
||||
<div class="login_l">
|
||||
<p class="font14">使用注册邮箱登录</p>
|
||||
<div class="span1">
|
||||
<label class="tn-form-label">邮箱:</label>
|
||||
<input class="tn-textbox" type="text" name="Login_name" id="Login_name" value="">
|
||||
</div>
|
||||
<div class="span1">
|
||||
<label class="tn-form-label">密码:</label>
|
||||
<input class="tn-textbox" type="password" name="Login_pwd" id="Login_pwd" value="">
|
||||
</div>
|
||||
<div class="tn-form-row-button">
|
||||
<div class="span1">
|
||||
<input name="" type="submit" class="tn-button-text" value="登 录">
|
||||
<span class="it-register-text">
|
||||
<input checked="checked" class="tn-checkbox" value="true" type="checkbox" name="rememberMe" id="rememberMe" >
|
||||
<label for="RememberPassword"> 记住密码</label>
|
||||
</span> </div>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="login_r">
|
||||
<p align="center"> <b>还没有帐号?</b><a href="register.jsp">10秒钟快速注册</a></p>
|
||||
|
||||
<div><img src="images/login_pic.jpg"></div>
|
||||
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
<iframe src="foot.html" width="100%" height="150" scrolling="no" frameborder="0" ></iframe>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Reference in new issue