// http://localhost:8085/user_cms/userController/showUser.do?id=1 @RequestMapping("showUser") public String showUserEntity(String id, ModelMap modelMap, HttpServletRequest request) { UserEntity u = userServiceImpl.getUserEntityById(id); if (u == null) { u = new UserEntity(); u.setEmail(""); u.setUserId(""); } modelMap.put("user", u); return "showUser"; }
@RequestMapping("/login") public String userLogin(HttpServletRequest request, ModelMap model) { String userName = request.getParameter("user_name"); String password = request.getParameter("password"); UserEntity user = new UserEntity(); user.setUserName(userName); user.setPassword(password); user = userServiceImpl.getUserByNameAndPassword(user); model.put("user", user); if (user != null) { return "index"; } return "page-login"; }
public String userCheckout(HttpServletRequest request) { String userName = request.getParameter("userName"); List<UserEntity> userList = userServiceImpl.findUsersByUserName(userName); if (userList == null || userList.isEmpty()) return "true"; return "false"; }
@RequestMapping("/user/{id}") public String detail(@PathVariable(value = "id") String id, ModelMap model) { model.put("user", userServiceImpl.getUserEntityById(id)); return "detail"; }
@RequestMapping("/userList") public String list(ModelMap model) { model.put("users", userServiceImpl.getUserEntities()); return "list"; }