Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @RequestMapping(value = "/admin/control", method = RequestMethod.POST)
- public String getListUser(Model model) {
- model.addAttribute("user", new User());
- model.addAttribute("listUser", userService.getListUser());
- return "control";
- }
- @RequestMapping(value = "admin/control/remove/{id}")
- public String removeUser(@PathVariable("id") Integer id) {
- userService.removeUser(id);
- return "redirect:/admin/control";
- }
- @Override
- public List<User> getListUser() { return userDao.findAll(); }
- @Override
- public void removeUser(Integer id) {
- userDao.delete(id);
- }
- <c:if test="${!empty listUser}">
- <div id="table-student">
- <table class="table table-striped">
- <tr class="tr">
- <td width="40">ID</td>
- <td width="100">Имя</td>
- <td width="100">Группа</td>
- <td width="60">Удалить</td>
- </tr>
- <c:forEach items="${listUser}" var="user">
- <tr>
- <td>${user.id}</td>
- <td>${user.username}</td>
- <td>
- <c:if test="${user.groupId eq 1}">ПО521</c:if>
- <c:if test="${user.groupId eq 2}">ПО411</c:if>
- <c:if test="${user.groupId eq 3}">ТЭ521</c:if>
- <c:if test="${user.groupId eq 4}">ТЭ411</c:if>
- </td>
- <td><a href="<c:url value='/admin/control/remove/${user.id}'/>">Удалить</a></td>
- </tr>
- </c:forEach>
- </table>
- </div>
- </c:if>
Add Comment
Please, Sign In to add comment