Guest User

Untitled

a guest
May 22nd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. @RequestMapping(value = "/admin/control", method = RequestMethod.POST)
  2. public String getListUser(Model model) {
  3. model.addAttribute("user", new User());
  4. model.addAttribute("listUser", userService.getListUser());
  5.  
  6. return "control";
  7. }
  8.  
  9. @RequestMapping(value = "admin/control/remove/{id}")
  10. public String removeUser(@PathVariable("id") Integer id) {
  11. userService.removeUser(id);
  12.  
  13. return "redirect:/admin/control";
  14. }
  15.  
  16. @Override
  17. public List<User> getListUser() { return userDao.findAll(); }
  18.  
  19. @Override
  20. public void removeUser(Integer id) {
  21. userDao.delete(id);
  22. }
  23.  
  24. <c:if test="${!empty listUser}">
  25.  
  26. <div id="table-student">
  27.  
  28. <table class="table table-striped">
  29. <tr class="tr">
  30. <td width="40">ID</td>
  31. <td width="100">Имя</td>
  32. <td width="100">Группа</td>
  33. <td width="60">Удалить</td>
  34. </tr>
  35.  
  36. <c:forEach items="${listUser}" var="user">
  37. <tr>
  38. <td>${user.id}</td>
  39. <td>${user.username}</td>
  40. <td>
  41. <c:if test="${user.groupId eq 1}">ПО521</c:if>
  42. <c:if test="${user.groupId eq 2}">ПО411</c:if>
  43. <c:if test="${user.groupId eq 3}">ТЭ521</c:if>
  44. <c:if test="${user.groupId eq 4}">ТЭ411</c:if>
  45. </td>
  46. <td><a href="<c:url value='/admin/control/remove/${user.id}'/>">Удалить</a></td>
  47. </tr>
  48. </c:forEach>
  49. </table>
  50.  
  51. </div>
  52.  
  53. </c:if>
Add Comment
Please, Sign In to add comment