Skip to content

Instantly share code, notes, and snippets.

@krams915
Created December 12, 2012 14:37
Show Gist options
  • Save krams915/4268228 to your computer and use it in GitHub Desktop.
Save krams915/4268228 to your computer and use it in GitHub Desktop.
Spring Thymeleaf UserController snippet
@Controller
@RequestMapping("/users")
public class UserController {
@RequestMapping
public String getUsersPage(ModelMap model) {
Pageable pageRequest = new PageRequest(0, 10);
Page<User> users = repository.findAll(pageRequest);
model.addAttribute("users", UserMapper.map(users));
model.addAttribute("commanduser", new UserDto());
model.addAttribute("usertype", "new");
return "users";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment