0
我是Spring MVC的新手,希望有人能幫我解決這個問題。我有這樣的jsp:如何將整個對象從jsp傳遞到彈簧控制器
<table border="1">
<tr>
<td width="50">Id</td>
<td width="150">First Name</td>
<td width="150">Last Name</td>
<td width="50">Money</td>
<td width="50"></td>
</tr>
<c:forEach items="${persons}" var="person">
<tr>
<td><c:out value="${person.id}" /></td>
<td><c:out value="${person.firstName}" /></td>
<td><c:out value="${person.lastName}" /></td>
<td><c:out value="${person.money}" /></td>
<td colspan="2"> <a href="<c:url value="removeContact" />">Delete</a></td>
</tr>
</c:forEach>
</table>
當用戶單擊刪除鏈接時,我想將整個對象(人)傳遞給控制器。有人可以幫助我怎麼做?我會感謝任何幫助。
這是我的控制器:
@RequestMapping(value = "/removeContact", method = RequestMethod.GET)
public String removeContact(@ModelAttribute("contact")Person person, BindingResult result) {
System.out.println("============ > "+person.getId());
return "index.jsp";
}
感謝