-
Jan 4th, 2012, 11:07 AM
#1
Upgrade from Spring MVC 3.0.5 to 3.1.0
Hello,
I've been upgrading my application from Spring 3.0.5-RELEASE to Spring 3.1.0-RELEASE this morning.
I upgrade all dependencies excepts Spring Security.
I now encounter a problem.
I have some REST url that i use with different request mapping :
.../flows/settings/{flowId} ==> GET
.../flows/settings/{flowId} ==> POST
.../flows/settings/{flowId} ==> DELETE
The GET goes well but when i try POST or DELETE, i got this error :
Request method 'POST' not supported
I've spend the whole afternoon searching the web and i don't understand what i'm missing ..
Does someone have an idea ?
thx a lot
Rémi
-
Jan 5th, 2012, 02:18 PM
#2
It would help if you showed what your request mappings look like.
-
Jan 6th, 2012, 02:08 AM
#3
In fact, i've found my problem.
I've some CRUD JSPs like this :
<form:form commandName="endpoint" id="form">
...
</form:form>
Where the url was something like ..../endpoint/{id}
In my controller, i've :
@RequestMapping(value="/{id}", method=RequestMethod.GET)
public String view(Model model, @PathVariable Integer id) {
model.addAttribute("endpoint", adminService.getEndpointById(id));
return "endpoints/view";
}
@RequestMapping(method=RequestMethod.POST)
public String save(Model model, @ModelAttribute("endpoint") @Valid Endpoint endpoint) {
...
}
@RequestMapping(method=RequestMethod.DELETE)
public String delete(Integer id, Model model) {
...
}
I've simply add the action attribute to the form tag and it works :
<c:url value="/settings/endpoints" var="formUrl"/>
<form:form commandName="endpoint" id="form" action="${formUrl}">
I now appear to me that it is normal to add this.
But, at final, i don't understand how my code has been working in the past.
Regards
Rémi
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules