2015-04-17 74 views
1

你好,我是用春天开机,RESTful Web服务和angularjs,请求方法 '删除' 不支持angularsjs springboot

这是我restControlleur

@RestController 
@RequestMapping("/structure") 
public class StructureNotificationRestContolleur { 

@Autowired 
StructureNotificationService StructureNotif; 
@Autowired 
ChampService champService; 

@RequestMapping(value = "/deleteChamp/{ch}", method=RequestMethod.DELETE) 
    public @ResponseBody void DeleteChamp(@PathVariable (value="ch") int ch) 
    { 
    champService.DeleteChamp(ch); 
    } 

有按钮删除:

$scope.deleteST= function(ids) 
      { 
       $http.delete('/structure/deleteChamp/'+ids). 
       success(function(data) { 
        alert(ids); 

       }); 

      } 

,但有错误: osweb.servlet.PageNotFound:请求方法 '删除' 不支持

???

+0

什么是“/ structure/deleteChamp /'+ ids'?它存在吗? – Pogrindis

+0

/structure/deleteChamp /它是要删除的其余方法的路径,“ids”是要删除的元素的ID? –

+0

我认为春季开机不知道方法'删除'???请求方法'DELETE'不支持 –

回答

0
$scope.deleteST= function(ids) 
     { 
      $http.delete('/structure/deleteChamp/', ids). 
      success(function(data) { 
       alert(ids); 

      }); 

     } 

编辑*** Clarificaction:本+加法paramether工作意味着你会结束了一个字符串作为操作的结果,而“” paramether意味着你会结束了一个字符串的URL加上你需要的javascript/Json对象。

尝试使用“,”而不是“+”

+0

尽管此代码可能会回答这个问题,但最好解释如何在不介绍其他人的情况下解决问题,以及为何使用它。从长远来看,仅有代码的答案是没有用的。 – JAL

相关问题