diff --git a/demo/src/main/java/com/example/demo/loginService/UserController.java b/demo/src/main/java/com/example/demo/loginService/UserController.java index b26009d..632243f 100644 --- a/demo/src/main/java/com/example/demo/loginService/UserController.java +++ b/demo/src/main/java/com/example/demo/loginService/UserController.java @@ -3,7 +3,6 @@ package com.example.demo.loginService; import com.example.demo.bean.User; import com.example.demo.loginService.API.impl.UserServiceImpl; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; @@ -42,12 +41,12 @@ public class UserController extends HttpServlet { result = 3; } if(result==1)response.sendRedirect("index.html"); - else if(result==2)response.sendRedirect("login.html"); - else response.sendRedirect("login.html"); + else if(result==2)response.sendRedirect("userPwdError.html"); + else response.sendRedirect("userNotExist.html"); } - @PostMapping("/login1") + @PostMapping("/register") public void handle1(HttpServletRequest request,HttpServletResponse response)throws IOException{ String userName = request.getParameter("userName"); String userPwd = request.getParameter("userPwd"); @@ -57,7 +56,7 @@ public class UserController extends HttpServlet { long count = 0; int result = 0; if(user!=null){ - result = 3; + result = 2; }else if(userPwd.equals(userPwd1)){ count = this.userServiceImpl.count()+1; SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH-mm-ss"); @@ -73,11 +72,11 @@ public class UserController extends HttpServlet { this.userServiceImpl.insertUser(user); result = 1; }else{ - result = 2; + result = 3; } - if(result==1)response.sendRedirect("注册成功"); - else if(result==2)response.sendRedirect("用户已存在"); - else response.sendRedirect("密码不相同"); + if(result==1)response.sendRedirect("login.html"); + else if(result==2)response.sendRedirect("userExisted.html"); + else response.sendRedirect("userPwdNotSame.html"); } diff --git a/demo/src/main/resources/static/Register.html b/demo/src/main/resources/static/Register.html index 2accbc8..5aa31a2 100644 --- a/demo/src/main/resources/static/Register.html +++ b/demo/src/main/resources/static/Register.html @@ -299,10 +299,10 @@ -
-

-

-

+ +

+

+

diff --git a/demo/src/main/resources/static/userExisted.html b/demo/src/main/resources/static/userExisted.html new file mode 100644 index 0000000..06aaac7 --- /dev/null +++ b/demo/src/main/resources/static/userExisted.html @@ -0,0 +1,12 @@ + + + + + Title + + + + + + + \ No newline at end of file diff --git a/demo/src/main/resources/static/userPwdNotSame.html b/demo/src/main/resources/static/userPwdNotSame.html new file mode 100644 index 0000000..2f2cfcd --- /dev/null +++ b/demo/src/main/resources/static/userPwdNotSame.html @@ -0,0 +1,12 @@ + + + + + Title + + + + + + + \ No newline at end of file