springMVC出现HTTP Status 405 - Request method 'GET' not supported错误的解决方法
今天在写一个简单的springMVC的表单请求处理时,出现了这个问题。我的form表单用的是post方法提交,并没有使用get方法,出现这个问题时,笔者可谓是一脸懵逼。
这是form表单:
这是对post请求的处理方法:
检查了半天,网上的方法也试了很多都无法解决,后来在一个原理讲解贴里发现了解决办法,分享给大家做参考。
原因:这是因为没有在对应的Controller类中添加对GET请求的处理方法。虽然笔者并没有使用get请求,但是在进入首页加载表单的时候,默认就是个get请求,而恰好这个请求被笔者的设置拦截了,所以当请求被拦截后又找不到对应的处理方法,报出了这个错误。
解决方法:在对应的Controller类中添加对GET请求的处理方法。
这个方法只是举例,我们可以根据具体的项目写不同处理操作。
PS:如果把上面的“method = RequestMethod.GET”这个去掉,就可以同时处理GET和POST请求。
springMVC出现HTTP Status 405 - Request method 'GET' not supported错误的解决方法相关推荐
- Restful风格,PUT修改功能请求,表单中存在文件报错-HTTP Status 405 - Request method 'POST' not supported...
解决方案配置如下 <!-- 配置文件上传解析器 --><bean id="multipartResolver" class="org.springfra ...
- springmvc:405 request method post not supported
$.ajax({type: "POST",url: "../userKvtableAll/bindOpt",data: "id="+id,d ...
- Request method 'GET' not supported解决方式
There was an unexpected error (type=Method Not Allowed, status=405). Request method 'GET' not suppor ...
- 我遇到的问题之request method ‘post’ not supported
文章目录 我遇到的问题之request method 'post' not supported 背景 尝试解决 源码大法好 总结 我遇到的问题之request method 'post' not su ...
- 浏览器出现Request method ‘GET‘ not supported (type=Method Not Allowed, status=405)的解决方法
Request method 'GET' not supported 不支持get请求方法,只支持POST方法 解决方案:把get请求改为post请求 一.火狐浏览器 Firefox可以直接编辑请求参 ...
- HTTP Status 405 - HTTP method POST is not supported by this URL
程序出现: HTTP Status 405 - HTTP method POST is not supported by this URL 发现原因如下 源程序: request.getRequest ...
- 基于 SpringMVC 的 POST 提交表单出现 405 错误的解决方法之一
现象 利用 SpringMVC 后端框架,在页面利用表单 (method="post") 提交数据,结果页面报 405 错误,提示 "Request method 'PO ...
- 【SpringBoot的坑】Restful请求报错Request method 'POST' not supported,HiddenHttpMethodFilter无法将POST转换为PUT原因分析
直接上结论: 因为 SpringBoot 版本原因,在我目前使用的 2.2.4 版本中,需要在springapplication.xml文件中 添加配置: spring.mvc.hiddenmetho ...
- org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'PUT' not supported
错误描述: org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'PUT' not suppo ...
最新文章
- 重磅! SLAM从入门到精通系统教程汇总
- 【问题解决方案】ImportError: No module named ‘openpyxl‘/‘xlrd’
- web移动端性能调优及16ms优化
- Mac系统下如何使用命令行方式启动MySQL
- 计算机一级115,计算机一级BASIC模拟115.doc
- 04_css盒子模型
- 基于 Vue BootStrap的迷你Chrome插件
- 论肱二头肌在日常生活中的锻炼的持久战|健身达人
- hp服务器引导驱动器,windows-server-2008 – 在没有SmartStart的HP Proliant服务器上安装Windows...
- NUMA与英特尔下一代Xeon处理器学习心得(10)
- 【转】Android业务组件化之URL Scheme使用
- Tuxedo中间件常用命令
- 台电平板(X80HD)刷WIN10
- 阿里云服务安装FTP服务器报200 227 entering passive mode(被动模式)错误
- 僵尸网络(CC服务器)
- 工控网络安全防护分析与建议
- 苹果再推7寸超级iPhone7,iPad何去何从?
- 【OpenCV学习笔记】之六 手写图像旋转函数---万丈高楼平地起
- 【svn】 如何在Linux服务器上添加svn账户的教程
- 安装Alpine操作系统