根据Spring文档here:请求方法 'POST' 不支持
While HTTP defines these four methods, HTML only supports two: GET and POST. Fortunately, there are two possible workarounds: you can either use JavaScript to do your PUT or DELETE, or simply do a POST with the 'real' method as an additional parameter (modeled as a hidden input field in an HTML form).
他们也做了后者,并且可以用下面的Spring MVC的表单标签来实现:
<form:form method="delete">
<input type="submit" value="Delete"/>
</form:form>
的问题是当我点击'删除'我的页面会抛出以下错误:
HTTP Status 405 - Request method 'POST' not supported
I ch anged的org.springframework.web
调试级别来调试,发现以下消息:
DEBUG AnnotationMethodHandlerExceptionResolver - Resolving exception from handler [[email protected]]:
org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'POST' not supported
我用RestClient用DELETE方法和如预期的方法被调用。我在这里做错了什么?
我想POST作为使用RESTClient实现参数和返回的状态码:405方法不被允许。问题在哪里? – Joopiter 2010-11-04 03:22:31
你可以发布你的控制器吗? – hisdrewness 2010-11-04 05:51:35
@hisdrewness是的,我可以,但我不认为问题出现在控制器的url映射中,因为使用RestClient可以正常工作。 – Joopiter 2010-11-04 07:50:30