src/controller/UserController.java
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
package controller;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import Pojo.User;
import service.UserService;
@Controller
public class UserController {
@Autowired
private UserService userService;
@RequestMapping("/login")
public String userList() throws Exception{
return "login";
}
@RequestMapping("/register")
public String registerlist() throws Exception{
return "register";
}
@RequestMapping("/logincheck")
public String login(User user,Model model,HttpSession httpSession) throws Exception{
User user1=userService.login(user);
if(user1!=null){
httpSession.setAttribute("user", user1);
if(user1.getType().equals("zuke")){
return "redirect:houselist.action";
}
else{
return "redirect:ahouselist.action";
}
}else{
String error="error";
model.addAttribute("error", error);
return "login";
}
}
@RequestMapping("/registercheck")
public String register(User user,Model model) throws Exception{
User user1=userService.register(user);
if(user1==null){
boolean registerStatu=userService.insertUser(user);
if(registerStatu){
return "login";
}
String error="error";
model.addAttribute("error", error);
return "register";
}else{
String error="error";
model.addAttribute("error", error);
后面还有 18 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。