Search in sources :

Example 1 with UserModel

use of ua.model.UserModel in project Logos_Materials_October_2017 by VolodymyrZavada.

the class BaseController method showUserDetail.

@GetMapping("/user/{userId}/detail")
public String showUserDetail(Model model, @PathVariable("userId") int userId, @RequestParam("name") String name, @RequestParam("age") int age, @RequestParam("email") String email) {
    UserModel userModel = new UserModel(userId, name, age, email);
    model.addAttribute("user", userModel);
    return "detail";
}
Also used : UserModel(ua.model.UserModel) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 2 with UserModel

use of ua.model.UserModel in project Logos_Materials_October_2017 by VolodymyrZavada.

the class BaseController method showUsersPage.

@GetMapping("/users")
public String showUsersPage(Model model) {
    List<UserModel> userModels = new ArrayList<>();
    userModels.add(new UserModel(1, "Abram", 45, "abram@mail.com"));
    userModels.add(new UserModel(2, "John", 35, "john@mail.com"));
    userModels.add(new UserModel(3, "Tim", 34, "tim@mail.com"));
    userModels.add(new UserModel(4, "Tom", 25, "tom@mail.com"));
    userModels.add(new UserModel(5, "Adam", 89, "adam@mail.com"));
    userModels.add(new UserModel(6, "R", 37, "r@mail.com"));
    model.addAttribute("userList", userModels);
    return "users";
}
Also used : UserModel(ua.model.UserModel) ArrayList(java.util.ArrayList) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Aggregations

GetMapping (org.springframework.web.bind.annotation.GetMapping)2 UserModel (ua.model.UserModel)2 ArrayList (java.util.ArrayList)1