@RequestMapping刪除操作(值=「/ RemoveOneSubject」,方法= RequestMethod.POST) 公共的ModelAndView RemoveOneSubject(HttpServletRequest的請求)拋出IOException異常{我需要一個REST URL我需要執行使用REST API我需要客戶端代碼我的代碼是這樣
ModelAndView model = new ModelAndView("RemoveOneSubject");
final String uri = "http://localhost:8080/subject/api/remove/{id}";
String id = request.getParameter("id");
RestTemplate restTemplate = new RestTemplate();
restTemplate.delete (uri,id);
model.addObject("theSubject", id);
return model;
enter code herejsp is
刪除
<table id="myTable" class="table table-striped">
<thead>
<tr>
<th></th>
<th>Name</th>
<th>Created by</th>
<th>Created time</th>
</td></th>
</tr>
</thead>
<tbody>
<c:if test="${not empty theSubject}">
<c:forEach var="listValue" items="${theSubject}">
<tr>
<td><input type="checkbox" name="chkBox"></td>
<td><a href=""><c:out value="${listValue.name}" /></a></td>
<td><c:out value="${listValue.createdBy}" /></td>
<td><c:out value="${listValue.createTime}" /></td>
<td><c:out value="${listValue.studentID}"></c:out></td> </tr>
</c:forEach>
</c:if>
</tbody>
</table>
請閱讀[mcve]並相應地提高您的問題。並提示:預覽窗口存在的原因。您希望我們花時間幫助您解決問題,因此您請花時間編寫格式良好的人性化問題。 – GhostCat