Esempio n. 1
0
 @ModelAttribute("user")
 public User getUser() {
   User user = new User();
   user.setUserId("1001");
   user.setUserName("<>");
   return user;
 }
Esempio n. 2
0
 @RequestMapping(value = "/handle63")
 public String handle63(ModelMap modelMap) {
   User user = (User) modelMap.get("user");
   user.setUserName("tom");
   modelMap.addAttribute("testAttr", "value1");
   return "/user/showUser";
 }
Esempio n. 3
0
 @RequestMapping(value = "/showUserListMix")
 public String showUserListMix(ModelMap mm) {
   Calendar calendar = new GregorianCalendar();
   List<User> userList = new ArrayList<User>();
   User user1 = new User();
   user1.setUserName("tom");
   user1.setRealName("汤姆1");
   calendar.set(1980, 1, 1);
   user1.setBirthday(calendar.getTime());
   User user2 = new User();
   user2.setUserName("john");
   user2.setRealName("约翰");
   user2.setBirthday(calendar.getTime());
   userList.add(user1);
   userList.add(user2);
   mm.addAttribute("userList", userList);
   return "userListMix";
 }
Esempio n. 4
0
 @RequestMapping(value = "/handle72")
 public String handle72(ModelMap modelMap, SessionStatus sessionStatus) {
   User user = (User) modelMap.get("user");
   if (user != null) {
     user.setUserName("Jetty");
     sessionStatus.setComplete();
   }
   return "/user/showUser";
 }
Esempio n. 5
0
 @RequestMapping(value = "/handle71")
 public String handle71(@ModelAttribute("user") User user) {
   user.setUserName("John");
   return "redirect:handle72.html";
 }
Esempio n. 6
0
 @RequestMapping(value = "/handle62")
 public String handle62(@ModelAttribute("user") User user) {
   user.setUserName("tom");
   return "/user/showUser";
 }