今天在写一个简单的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错误的解决方法相关推荐

  1. Restful风格,PUT修改功能请求,表单中存在文件报错-HTTP Status 405 - Request method 'POST' not supported...

    解决方案配置如下 <!-- 配置文件上传解析器 --><bean id="multipartResolver" class="org.springfra ...

  2. springmvc:405 request method post not supported

    $.ajax({type: "POST",url: "../userKvtableAll/bindOpt",data: "id="+id,d ...

  3. Request method 'GET' not supported解决方式

    There was an unexpected error (type=Method Not Allowed, status=405). Request method 'GET' not suppor ...

  4. 我遇到的问题之request method ‘post’ not supported

    文章目录 我遇到的问题之request method 'post' not supported 背景 尝试解决 源码大法好 总结 我遇到的问题之request method 'post' not su ...

  5. 浏览器出现Request method ‘GET‘ not supported (type=Method Not Allowed, status=405)的解决方法

    Request method 'GET' not supported 不支持get请求方法,只支持POST方法 解决方案:把get请求改为post请求 一.火狐浏览器 Firefox可以直接编辑请求参 ...

  6. 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 ...

  7. 基于 SpringMVC 的 POST 提交表单出现 405 错误的解决方法之一

    现象 利用 SpringMVC 后端框架,在页面利用表单 (method="post") 提交数据,结果页面报 405 错误,提示 "Request method 'PO ...

  8. 【SpringBoot的坑】Restful请求报错Request method 'POST' not supported,HiddenHttpMethodFilter无法将POST转换为PUT原因分析

    直接上结论: 因为 SpringBoot 版本原因,在我目前使用的 2.2.4 版本中,需要在springapplication.xml文件中 添加配置: spring.mvc.hiddenmetho ...

  9. org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'PUT' not supported

    错误描述: org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'PUT' not suppo ...

最新文章

  1. 重磅! SLAM从入门到精通系统教程汇总
  2. 【问题解决方案】ImportError: No module named ‘openpyxl‘/‘xlrd’
  3. web移动端性能调优及16ms优化
  4. Mac系统下如何使用命令行方式启动MySQL
  5. 计算机一级115,计算机一级BASIC模拟115.doc
  6. 04_css盒子模型
  7. 基于 Vue BootStrap的迷你Chrome插件
  8. 论肱二头肌在日常生活中的锻炼的持久战|健身达人
  9. hp服务器引导驱动器,windows-server-2008 – 在没有SmartStart的HP Proliant服务器上安装Windows...
  10. NUMA与英特尔下一代Xeon处理器学习心得(10)
  11. 【转】Android业务组件化之URL Scheme使用
  12. Tuxedo中间件常用命令
  13. 台电平板(X80HD)刷WIN10
  14. 阿里云服务安装FTP服务器报200 227 entering passive mode(被动模式)错误
  15. 僵尸网络(CC服务器)
  16. 工控网络安全防护分析与建议
  17. 苹果再推7寸超级iPhone7,iPad何去何从?
  18. 【OpenCV学习笔记】之六 手写图像旋转函数---万丈高楼平地起
  19. 【svn】 如何在Linux服务器上添加svn账户的教程
  20. 安装Alpine操作系统

热门文章

  1. [PHP] Phalcon操作示范
  2. tcpdump移植和使用
  3. [Android]ListView性能优化之视图缓存
  4. OpenWebSpider 安装使用
  5. CFRunLoopRef 的内部逻辑(向 ibireme学习)
  6. 浅谈WPF的VisualBrush
  7. Cstring的使用
  8. ArcEngine 直连连接SDE
  9. (转)C语言位运算详解
  10. 如何终止正在在发送的ajax请求