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 ...
随机推荐
- JSP Ueditor 实现图片跨域上传
Ueditor的单图上传,在官方文档上明确写了不支持 然后通过百度找了许多方案,终于有一个可以解决了. http://www.cnblogs.com/hpnet/p/6290452.html 不过那个 ...
- Android开发 - 掌握ConstraintLayout(八)障碍线(Barrier)
本文我们来介绍障碍线(Barrier)的使用,平常在开发中用的相对要少一些,但是在需要时会非常方便. 它的作用是将多个元素放到这个障碍线里面使时,其中的任何元素的大小或位置变化时都会使它的位置进行改变 ...
- 微信小程序的概要
微信小程序的概要 学习小程序要了解一下什么事小程序,小程序开发前需要做哪些准备,微信小程序开发工具的使用,小程序中的目录结构解析,视图和渲染,事件. 小程序的配置详解,小程序的生命周期与app对象的使 ...
- CCS3怎么实现border边框渐变效果
下图注册按钮的边框有渐变效果,如果让你来实现,你会怎么做呢 个人觉得,省事的做法,直接让UI给背景图片就可以了,如下图 不过这种做法感觉不太灵活,如果要修改border的渐变颜色,就需要UI重新做图. ...
- apollo入门demo实战(二)
1. apollo入门demo实战(二) 1.1. 下载demo 从下列地址下载官方脚本和官方代码 https://github.com/nobodyiam/apollo-build-scripts ...
- Core统一日志处理
新建一个Core的Web项目,然后创建相关文件等 添加一个处理错误的类库ErrorMiddleware 下面是该类库的代码 public class ErrorMiddleware { stati ...
- 排除Transformation Errors
当运行session时,会产生大量的Transformation Errors,这些Error会导致性能变慢 1 Transformation Errors导致性能降低的原因 当有大量记录有Trans ...
- Kubernetes集群搭建之系统初始化配置篇
Kubernetes的几种部署方式 1. minikube Minikube是一个工具,可以在本地快速运行一个单点的Kubernetes,尝试Kubernetes或日常开发的用户使用.不能用于生产环境 ...
- 深度学习Dubbo系列(入门开篇)
此文档为系列学习文档 这系列文档详细讲解了dubbo的使用,基本涵盖dubbo的所有功能特性.在接下来的文章里会详细介绍. 如果你正依赖dubbo作为你业务工程的RPC通信框架,这里可以作为你的参考手 ...
- C++版 - 剑指offer 面试题4: 替换空格 题解
面试题4:替换空格 提交网址: http://www.nowcoder.com/practice/4060ac7e3e404ad1a894ef3e17650423?tpId=13&tqId=1 ...