简体   繁体   English

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

[英]Single page web application refresh button Get not supported

I am using angularjs and spring mvc to build an Application, I have written rest api, which will get data from back end and i am displaying it using angularjs ng-grid. 我正在使用angularjs和spring mvc来构建应用程序,我编写了rest api,它将从后端获取数据,并使用angularjs ng-grid显示它。 My question is when i click on refresh button i am getting response as HTTP Status 405 - Request method 'GET' not supported what is the reason i am getting this response ? 我的问题是,当我单击“刷新”按钮时,我将收到响应,因为HTTP状态405-不支持请求方法“ GET”。我收到此响应的原因是什么? and how to solve this ? 以及如何解决呢?

is there any way if i click on refresh button of browser it should point to landing page of my application. 有什么办法,如果我单击浏览器的刷新按钮,它应该指向我的应用程序的登录页面。

Angular js controller code 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 Controller code Spring Mvc控制器代码

@RequestMapping(value="/getCustomer" , method=RequestMethod.GET)

public List<Customer> getCustomerList() throws IOException{

    List<Customer> customers= customerDao.getCustomer();
    return customers;
}

You have to cancel ajax cache method while using "get" 您必须在使用“获取”时取消ajax缓存方法

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

Or you can cancel all cache operations in tags; 或者,您可以取消标签中的所有缓存操作;

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

but it will not really effective while some times :) 但是有时它不会真正有效:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM