springframework Request method 'GET' not supported

javaweb开发的时候碰见这个错误,写下来,记录一下

org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver.handleHttpRequestMethodNotSupported(198) | Request method ‘GET’ not supported

这是js的代码,请求的时候默认的是get请求

$("#outBtn").click(function (){
    var url=sysurl+"pay/outExcel";
    window.open(url);
});

而后端的代码是这样

 @ResponseBody
    @RequestMapping(value ="/outExcel",method = RequestMethod.**POST**)//注意这里给成get请求就好了
    public void outExcell(HttpServletRequest request,HttpServletResponse response) throws Exception{

猜你喜欢

转载自blog.csdn.net/Yin_Xian/article/details/76223160