Request method 'POST' not supported错误和解决方法
在使用SpringBoot的时候,在html页面用form表单post提交数据的时候报错:
Request method 'POST' not supported
错误解析:
我是用的前端页面是HTML页面,而HTML文件,它并不支持响应头带有 post 的应答包,所以会报错。
而且在测试的时候进入到了Controller方法内,只是在进行页面跳转的时候,报错。
所以无法完成跳转操作。
解决方法:
- 若条件允许,使用 jsp 等能够接收 post 应答包的页面文件。使用jsp页面就可以完美解决问题。但是不太建议。
- 使用 “redirect:映射路径”进行跳转。这个建议使用的。
测试代码:

在这个代码中可以看到我框起来的返回值,是直接返回个页面了。但是HTML不支持POST应答包。所以:
解决:

这次我没有直接返回到页面。而是使用的重定向到另一个Controller内,然后有另一个Controller跳转到页面。ok。完成。
若是和我一样的问题可以试一下。
Request method 'POST' not supported错误和解决方法的更多相关文章
- springMVC出现HTTP Status 405 - Request method 'GET' not supported错误的解决方法
今天在写一个简单的springMVC的表单请求处理时,出现了这个问题.我的form表单用的是post方法提交,并没有使用get方法,出现这个问题时,笔者可谓是一脸懵逼. 这是form表单: 这是对po ...
- SpringMVC框架出现 405 request method post not supported 的解决方法
在SpringMVC框架中当使用post请求服务,然后请求成功转到一个静态文件,如html,htm等网页时.页面出现405 request method post not supported错误,只要 ...
- Request method 'GET' not supported
Request method 'GET' not supported 错误原因: GET请求不被允许. 解决方法: 1.从客户端入手.假设浏览器中的js用了ajax发起异步请求GET,将GET改为PO ...
- springmvc访问静态资源出现Request method 'GET' not supported
答案最后.:D 默认的访问的URL都会被DispatcherServlet所拦截. 这里说一下如何配置springmvc访问静态文件. <mvc:default-servlet-handler/ ...
- org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'GET' not supported解决!
org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'GET' not supported解决 ...
- oauth2(spring security)报错method_not_allowed(Request method 'GET' not supported)解决方法
报错信息 <MethodNotAllowed> <error>method_not_allowed</error> <error_description> ...
- Spring boot: Request method 'DELETE' not supported, Request method 'PUT' not supported, Request method 'POST' not supported
GET,POST,PUT,DELETE, Spring都支持,不要怀疑Spring, 一定是前端发送的rest 请求和后端的响应不匹配, 查找原因以及解决办法, 很简单 用chrome打开F12控制台 ...
- org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'PUT' not supported
1:先上控制台报错信息 org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'PUT' not ...
- Spring MVC出现POST 400 Bad Request &405 Request method 'GET' not supported
首先描述一下出现错误的情景: 我刚学springmvc,想做一个登录界面的东西.然后试着写了一个controller如下: @RequestMapping(value = "/login&q ...
随机推荐
- python爬虫学习之爬取全国各省市县级城市邮政编码
实例需求:运用python语言在http://www.ip138.com/post/网站爬取全国各个省市县级城市的邮政编码,并且保存在excel文件中 实例环境:python3.7 requests库 ...
- 13.缓存、三级缓存、内存溢出、AsyncTask
SharePreference工具类 /** * SharePreference封装 * */ public class PrefUtils { public static final String ...
- 每天学点SpringCloud(五):如何使用高可用的Eureka
前几篇文章我们讲了一下Eureka的基础使用,但是呢有一个很重要的问题,我们讲的都是单机版的情况,如果这个时候Eureka服务挂了的话,那么我们的服务提供者跟服务消费者岂不是都废了?服务提供者和消费者 ...
- canvas转图片中的文字自动换行
概述 最近项目用到了canvas转图片,但是由于canvas对文字排版的支持非常弱,一般我们在canvas上画不同排版的文字(比如竖排文字)都是利用js计算横纵坐标,然后一个字一个字地画出来,今天无意 ...
- document.getElementById 和 document.getElementsByClassName获取DOM元素的区别
想必小伙伴们对于 JS 获取DOM的几种方法早已烂熟于心,了然于胸, 尤其是 document.getElementById 和 document.getElementsByClassName, ...
- FileZilla 使用笔记
FileZilla 使用了三年了,一些功能其实还没有主动去发现,这次接着项目忙完的空闲时间整理一下 Tips,提高工作效率,方便以后查阅. 一.好用的功能 1.Site Manager - 站点管理器 ...
- Group By Grouping Sets
Group by分组函数的自定义,与group by配合使用可更加灵活的对结果集进行分组,Grouping sets会对各个层级进行汇总,然后将各个层级的汇总值union all在一起,但却比单纯的g ...
- Taro 多端开发的正确姿势:打造三端统一的网易严选(小程序、H5、React Native)
笔者所在的趣店 FED 早在去年 10 月份就已全面使用 Taro 框架开发小程序(当时版本为 1.1.0-beta.4),至今也上线了 2 个微信小程序.2 个支付宝小程序. 之所以选用 Taro, ...
- odoo开发笔记 -- div标签代替odoo button写法
odoo开发笔记 -- div标签代替odoo button写法 并调用自定义js <footer> <div id="confirm_request_cloud_repo ...
- mysql 开发基础系列12 选择合适的数据类型(上)
一. char 与varchar比较 在上图的最后一行的值只适用在"非严格模式",关于严格模式后面讲到.在“开发基础系列4“ 中讲到CHAR 列删除了尾部的空格.由于char是固定 ...