Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/453.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 请求方法';把';不支持_Javascript_Angularjs_Spring Boot_Spring Data Rest - Fatal编程技术网

Javascript 请求方法';把';不支持

Javascript 请求方法';把';不支持,javascript,angularjs,spring-boot,spring-data-rest,Javascript,Angularjs,Spring Boot,Spring Data Rest,我在和springboot angularsjs和restful合作 我的休息控制器 @RequestMapping(value="/updatestructure/{ch}",method = RequestMethod.PUT) public @ResponseBody Structurenotification updateStructure(@PathVariable(value="ch") StructureNotificationDto ch) { return Struct

我在和springboot angularsjs和restful合作

我的休息控制器

@RequestMapping(value="/updatestructure/{ch}",method = RequestMethod.PUT)
public @ResponseBody Structurenotification updateStructure(@PathVariable(value="ch") StructureNotificationDto ch) {
    return StructureNotif.update(ch);
}
按钮

$scope.addstructure = function() {
      $http.put('/structure/updatestructure/', $scope.element);
};
但我有一个问题:

o、 s.web.servlet.PageNotFound:不支持请求方法“PUT”


您已将
{ch}
变量定义为
PathVariable
,并将其作为请求正文发送。映射接受URL,如
/structure/updatestructure/abc
/structure/updatestructure/efg
,值
abc
efg
将作为字符串传递。在这种情况下,映射应该如下所示

@RequestMapping(value="/updatestructure/{ch}",method = RequestMethod.PUT)
public @ResponseBody Structurenotification updateStructure(@PathVariable String ch) {    
}
但是,实际上,您将发送一个JSON作为请求体(假设从您的角度
$http.put(url,数据)
)。 您的映射应如下所示:

@RequestMapping(value="/updatestructure/",method = RequestMethod.PUT)
public @ResponseBody Structurenotification updateStructure(@RequestBody StructureNotificationDto ch) {
    return StructureNotif.update(ch);
}

您已将
{ch}
变量定义为
PathVariable
,并将其作为请求正文发送。映射接受URL,如
/structure/updatestructure/abc
/structure/updatestructure/efg
,值
abc
efg
将作为字符串传递。在这种情况下,映射应该如下所示

@RequestMapping(value="/updatestructure/{ch}",method = RequestMethod.PUT)
public @ResponseBody Structurenotification updateStructure(@PathVariable String ch) {    
}
但是,实际上,您将发送一个JSON作为请求体(假设从您的角度
$http.put(url,数据)
)。 您的映射应如下所示:

@RequestMapping(value="/updatestructure/",method = RequestMethod.PUT)
public @ResponseBody Structurenotification updateStructure(@RequestBody StructureNotificationDto ch) {
    return StructureNotif.update(ch);
}

我认为这个问题可能与Java比JavaScript更相关我认为这个问题可能与Java比JavaScript更相关