我使用angularjs和spring mvc来构建一个应用程序,我写了其余的api,它将从后端获取数据,并且使用angularjs ng-grid显示它。我的问题是,当我点击刷新按钮,我得到的答复为HTTP状态405 - 不支持请求方法'GET'我得到这个响应的原因是什么?以及如何解决这个问题?单页网页应用程序刷新按钮不支持
有什么办法,如果我点击浏览器的刷新按钮,它应该指向我的应用程序的着陆页。
角的js控制器代码
function customerController($scope,$http,$window,$location,updateFactory) {
$scope.customerId;
$scope.customerEmail;
$scope.CustName;
$http.get("./getCustomer")
.success(function(response) {$scope.customers = response;});
$scope.filterOptions = {
filterText: ''
};}
的Spring MVC控制器代码
@RequestMapping(value="/getCustomer" , method=RequestMethod.GET)
public List<Customer> getCustomerList() throws IOException{
List<Customer> customers= customerDao.getCustomer();
return customers;
}
你最好告诉我们你是如何调用REST API(您angularjs代码)和控制器的实现。我想你没有好好处理'@ RequestMapping'。 – Rebornix
我已经添加了代码 – user3844950