在SpringMVC框架中当使用post请求服务,然后请求成功转到一个静态文件,如html,htm等网页时。页面出现405 request method post not supported错误,只要在spring的配置文件中加入下面代码即可:

<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="urlMap">
<map>
<entry key="/pages/*.html" value="myResourceHandler" />
</map>
</property>
<property name="order" value="100000" />
</bean> <bean id="myResourceHandler" name="myResourceHandler" class="org.springframework.web.servlet.resource.ResourceHttpRequestHandler">
<property name="locations" value="/pages/*.html" />
<property name="supportedMethods">
<list>
<value>GET</value>
<value>HEAD</value>
<value>POST</value>
</list>
</property>
</bean>

SpringMVC框架出现 405 request method post not supported 的解决方法的更多相关文章

  1. Spring MVC出现POST 400 Bad Request &405 Request method 'GET' not supported

    首先描述一下出现错误的情景: 我刚学springmvc,想做一个登录界面的东西.然后试着写了一个controller如下: @RequestMapping(value = "/login&q ...

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

    背景:点击提交按钮ajax请求接口时,报出错误[ Whitelabel Error Page This application has no explicit mapping for /error, ...

  3. springMVC出现HTTP Status 405 - Request method 'GET' not supported错误的解决方法

    今天在写一个简单的springMVC的表单请求处理时,出现了这个问题.我的form表单用的是post方法提交,并没有使用get方法,出现这个问题时,笔者可谓是一脸懵逼. 这是form表单: 这是对po ...

  4. HTTP Status 405 - Request method 'GET' not supported?(尚硅谷Restful案例练习关于Delete方法出现的错误)

    哈罗大家好,最近在如火如荼的学习java开发----Spring系列框架,当学习到SpringMVC,动手实践RESTFUL案例时,发现了以上报错405,get请求方法没有被支持. 首先第一步,我查看 ...

  5. 使用SpringMVC时报错HTTP Status 405 - Request method 'GET' not supported

    GET方法不支持.我出错的原因在于,在JSP中我希望超链接a以post方式提交,但是这里写js代码时出错. <script type="text/javascript"> ...

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

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

  7. springmvc访问静态资源出现Request method 'GET' not supported

    答案最后.:D 默认的访问的URL都会被DispatcherServlet所拦截. 这里说一下如何配置springmvc访问静态文件. <mvc:default-servlet-handler/ ...

  8. 常见踩坑案例(二)-Request method 'POST' not supported

    一 前言 最近涉及到与前后端的数据对接,按道理来说没一点压力结果被一前端童鞋带坑里去了(不过也是很久没写过这种前后端分离进行联调的事情了,如果是一个人全套弄的话就不会出现下面问题). 二 Reques ...

  9. Feign发送Get请求时,采用POJO对象传递参数的最终解决方案 Request method 'POST' not supported (附带其余好几个坑)

    yml: feign: httpclient: enabled: true properties: #feign feign.httpclient.enabled=true <!-- https ...

随机推荐

  1. 网站JS控制的QQ悬浮

    这是一个网站JS控制的QQ悬浮客服:代码1document.writeln("<div id=\"feedback\"><div id=\"f ...

  2. windows server 2012R2 故障转移集群配置

    配置说明: AD:10.10.1.10/24  Node-2:10.10.1.20/24 Node-3:10.10.1.30/24 zhangsan-PC:10.10.1.50/24  VIP1:10 ...

  3. TZOJ 2392 Bounding box(正n边形三点求最小矩形覆盖面积)

    描述 The Archeologists of the Current Millenium (ACM) now and then discover ancient artifacts located ...

  4. Oracle lag()/lead() over()分析函数

    with tmp as(select '1' id ,'aa' name ,'22' age from dual union allselect '2' id ,'bb' name ,'20' age ...

  5. 机器学习入门-BP神经网络模型及梯度下降法-2017年9月5日14:58:16

    BP(Back Propagation)网络是1985年由Rumelhart和McCelland为首的科学家小组提出,是一种按误差逆传播算法训练的多层前馈网络,是目前应用最广泛的神经网络模型之一. B ...

  6. css fixed 失效问题解法

    https://stackoverflow.com/questions/11258877/fixed-element-disappears-in-chrome 开启css硬件加速,transform: ...

  7. macOS HomeBrew更换源 brew常用命令说明

    homebrew本身就是一个git仓库.使用homebrew安装软件包时,会自动先下载软件包,然后解压安装,但有时候下载会卡住,或者很慢,这个时候有以下几种方法: 1.临时的终止update,先con ...

  8. 在Linux系统上安装Compose

    在Linux上,您可以从GitHub上的Compose存储库发行页面下载Docker Compose二进制文件.按照链接中的说明进行操作,该链接涉及curl在终端中运行命令以下载二进制文件.这些分步说 ...

  9. Linux sleep 语句以及循环 测试负载

    sleep 命令 sleep 1    睡眠1秒sleep 1s    睡眠1秒sleep 1m   睡眠1分sleep 1h   睡眠1小时 总代码 #!/bin/bash for i in {1. ...

  10. Movavi Video Editor 15 Plus Mac怎样更改视频的分辨率?

    使用Movavi Video Editor 15您可以对视频进行切割和修剪,裁剪和旋转,色度键,视频稳定以及画中画等很多的编辑,该软件操作简单,就算是新手也无需担心操作问题,本文讲述了Movavi V ...