Spring MVC handle button event in list
- by GigaPr
Hi,
i created a list of Users
<div class="usersList">
<c:forEach items="${users}" var="user">
<div class="listElementAction">
<c:out value="${user.id}"/>
</div>
<div class="listElement">
<c:out value="${user.firstName}"/>
</div>
<div class="listElement">
<c:out value="${user.lastName}"/>
</div>
<div class="listElement">
<c:out value="${user.username}"/>
</div>
<div class="listElementAction">
<input type="button" name="Edit" title="Edit" value="Edit" />
</div>
<div class="listElementAction">
<input type="image" src="images/delete.png" name="image" value="${user.id}" alt="Delete" onclick="return confirm('Do you want to delete ${user.username}?')" >
</div>
<br />
</c:forEach>
</div>
and my controler looks like this
public class UsersController implements Controller {
private UserServiceImplementation userServiceImplementation;
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
ModelAndView modelAndView = new ModelAndView("users");
modelAndView.addObject("users", this.userServiceImplementation.get());
return modelAndView;
}
public UserServiceImplementation getUserServiceImplementation() {
return userServiceImplementation;
}
public void setUserServiceImplementation(UserServiceImplementation userServiceImplementation) {
this.userServiceImplementation = userServiceImplementation;
}
}
How can i handle the delete and edit button event?