2015-04-17 40 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

相關問題