我有一个基于Spring Web模型-视图-控制器(MVC)框架的项目。Spring Web model-view-controller (MVC)框架的版本是部署在WebLogic服务器上的3.2.8版本: 12.1.2.0.0
我的JSP中有这段代码
<button id="deleteImageButtonId165850" class="btn btn-primary" type="submit" >Delete Image</button>
<script>
$('#deleteImageButtonId165850').click(function(){$('#serviceFormId').attr('action', 'http://127.0.0.1:7001/devices/newdesign/manage/application/service/image/del/165850');
$('#serviceFormId').attr('method', 'delete');});
</script>和我的控制器
@RequestMapping(value = { "/newdesign/manage/application/service/image/del/{imageId}",
"/newdesign/manage/application/service/image/del/{imageId}/" }, method = { RequestMethod.DELETE })
public String deleteServiceImage(@ModelAttribute("serviceForm") ServiceForm serviceForm, @PathVariable Long imageId,
HttpServletRequest request, Model model) throws Exception {
..
}但是当我点击按钮时,我得到了一个
Request method 'GET' not supported发布于 2017-01-30 20:26:58
HTML表单只支持GET和POST。您必须在JavaScript中进行删除。
发布于 2017-01-30 20:26:27
测试以下代码
@RequestMapping(value = { "/newdesign/manage/application/service/image/del/{imageId}",
"/newdesign/manage/application/service/image/del/{imageId}/" }, method = { RequestMethod.POST })
public String deleteServiceImage(@ModelAttribute("serviceForm") ServiceForm serviceForm, @PathVariable Long imageId,
HttpServletRequest request, Model model) throws Exception {
..
}https://stackoverflow.com/questions/41935698
复制相似问题