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 ...
随机推荐
- J2EE导论 | 疑惑篇
J2EE是Java程序员从新手进阶的一个必经之路.要体会所谓的工业级代码,就必须要融入和经历更为复杂的开发.部署环境,需要同更多的模块.组件做信息流交换,比较和使用不同的框架,逐一去琢磨和考察它们的必 ...
- 全栈开发工程师微信小程序-中(中)
全栈开发工程师微信小程序-中(中) 开放能力 open-data 用于展示微信开放的数据 type 开放数据类型 open-gid 当 type="groupName" 时生效, ...
- C#遍历文件夹下面所有指定格式文件
C#遍历指定文件夹中的所有文件 DirectoryInfo TheFolder=new DirectoryInfo(folderFullName);//遍历文件夹foreach(DirectoryIn ...
- python爬取猫眼电影top100
最近想研究下python爬虫,于是就找了些练习项目试试手,熟悉一下,猫眼电影可能就是那种最简单的了. 1 看下猫眼电影的top100页面 分了10页,url为:https://maoyan.com/b ...
- bootstrap treeview实现菜单树
本博客,介绍通过Bootstrap的treeview插件实现菜单树的功能. treeview链接:http://www.htmleaf.com/Demo/201502141380.html ORM框架 ...
- 用Ajax遍历三级下拉框
用Ajax遍历三级下拉框 //通过一级分类的id查二级分类(记得在前端网页按钮绑定点击事件) function getSecondCategory(oneCategoryId){ alert(&quo ...
- Python 高度定制化自己的线程类和进程类代码,获取启动进程或线程方法的结果(兼容Py2和Py3)
#encoding=utf-8 from threading import Thread from multiprocessing import Process import multiprocess ...
- GitHub学习系列之如何删除那些不打算要的项目(图文详解)
不多说,直接上干货! 1.选择我们要删除的项目: 接下来我们就删除 zlslch下面的这个hello项目.从这个项目的名字中就可以看出来,好像就是为了删除而创建的.点击右上方红框中的Settings. ...
- [Shell]sed命令在MAC和Linux下的不同使用方式
---------------------------------------------------------------------------------------------------- ...
- mongo-spark-读取不同的库数据和写入不同的库中
mongo-spark-读取不同的库数据和写入不同的库中 package com.example.app import com.mongodb.spark.config.{ReadConfig, Wr ...