admin管理员组文章数量:1431500
I'm working with springboot angularsjs and restful.
my rest controller
@RequestMapping(value="/updatestructure/{ch}",method = RequestMethod.PUT)
public @ResponseBody Structurenotification updateStructure(@PathVariable(value="ch") StructureNotificationDto ch) {
return StructureNotif.update(ch);
}
the button
$scope.addstructure = function() {
$http.put('/structure/updatestructure/', $scope.element);
};
But I get this problem :
o.s.web.servlet.PageNotFound: Request method 'PUT' not supported
I'm working with springboot angularsjs and restful.
my rest controller
@RequestMapping(value="/updatestructure/{ch}",method = RequestMethod.PUT)
public @ResponseBody Structurenotification updateStructure(@PathVariable(value="ch") StructureNotificationDto ch) {
return StructureNotif.update(ch);
}
the button
$scope.addstructure = function() {
$http.put('/structure/updatestructure/', $scope.element);
};
But I get this problem :
Share Improve this question edited Dec 1, 2015 at 19:20 r007 3041 gold badge2 silver badges17 bronze badges asked Apr 19, 2015 at 12:41 majed ben alimajed ben ali 311 silver badge8 bronze badges 1o.s.web.servlet.PageNotFound: Request method 'PUT' not supported
- I think this problem could be more related to Java than JavaScript – MDEV Commented Apr 19, 2015 at 13:20
1 Answer
Reset to default 5You have defined your {ch}
variable as PathVariable
, and you send it as Request Body. You Mapping accepts URL's like /structure/updatestructure/abc
,/structure/updatestructure/efg
, and values abc
and efg
would be than passed as strings. In this case your mapping should look like this.
@RequestMapping(value="/updatestructure/{ch}",method = RequestMethod.PUT)
public @ResponseBody Structurenotification updateStructure(@PathVariable String ch) {
}
But, your are actualli going to send a JSON as request body(assuming from your angular $http.put(url,data)
).
Your mapping should be then as follows:
@RequestMapping(value="/updatestructure/",method = RequestMethod.PUT)
public @ResponseBody Structurenotification updateStructure(@RequestBody StructureNotificationDto ch) {
return StructureNotif.update(ch);
}
本文标签: javascriptRequest method 39PUT39 not supportedStack Overflow
版权声明:本文标题:javascript - Request method 'PUT' not supported - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745538613a2662388.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论