不支持单页web应用程序刷新按钮Get

Single page web application refresh button Get not supported

本文关键字:按钮 Get 刷新 应用程序 单页 web 不支持      更新时间:2023-09-26

我正在使用angularjs和spring mvc来构建一个应用程序,我已经编写了rest api,它将从后端获取数据,我正在使用angularjs ng-grid显示它。我的问题是,当我点击刷新按钮时,我得到的响应是HTTP状态405 -请求方法'GET'不支持我得到这个响应的原因是什么?如何解决这个问题呢?

有没有办法,如果我点击浏览器的刷新按钮,它应该指向我的应用程序的登陆页面。

Angular 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;
}

在使用"get"时必须取消ajax缓存方法

$.ajax({
    url: 'xyz.com',
    cache: false,
    type: 'GET',
    data: yourData,
    success: successfunction,
    error: errorfunction 
});

或者取消标签中的所有缓存操作;

<meta http-equiv="PRAGMA" content="NO-CACHE">

,但它不会真正有效,而有时:)