Joo*_*ter 8 java spring-mvc url-rewriting
根据这里的Spring文档:
虽然HTTP定义了这四种方法,但HTML只支持两种:GET和POST.幸运的是,有两种可能的解决方法:您可以使用JavaScript来执行PUT或DELETE,或者只使用"real"方法作为附加参数进行POST(在HTML表单中建模为隐藏输入字段).
他们已经完成了后者,并且可以使用以下spring MVC表单标记来实现:
<form:form method="delete">
<input type="submit" value="Delete"/>
</form:form>
Run Code Online (Sandbox Code Playgroud)
问题是,当我单击"删除"时,我的页面会抛出以下错误:
HTTP Status 405 - Request method 'POST' not supported
Run Code Online (Sandbox Code Playgroud)
我将调试级别更改org.springframework.web为debug并找到以下消息:
DEBUG AnnotationMethodHandlerExceptionResolver - Resolving exception from handler [foo.bar.MessageForm@da9246]:
org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'POST' not supported
Run Code Online (Sandbox Code Playgroud)
我使用RestClient和DELETE方法,并按预期调用该方法.我在这做错了什么?
| 归档时间: |
|
| 查看次数: |
44253 次 |
| 最近记录: |