According to the Spring Documentation here :
Although HTTP defines these four methods, HTML only supports two: GET and POST. Fortunately, there are two possible solutions: you can use JavaScript to execute PUT or DELETE, or simply make POST using the "real" method as an additional parameter (modeled as a hidden input field in an HTML form).
They did the latter and can be achieved using the following Spring MVC form tag:
<form:form method="delete"> <input type="submit" value="Delete"/> </form:form>
The problem is that when I click "Delete", my page produces the following error:
HTTP Status 405 - Request method 'POST' not supported
I changed the debug level of org.springframework.web for debugging and found the following message:
DEBUG AnnotationMethodHandlerExceptionResolver - Resolving exception from handler [foo.bar.MessageForm@da9246]: org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'POST' not supported
I used RestClient with the DELETE method, and the method is called as expected. What am I doing wrong here?
java spring-mvc url-rewriting
Joopiter
source share