在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. checkpoint防火墙SmartDashboard登录出错

    SmartDashboard登录是报错:fingerprint不匹配 原因:主备机切换导致 解决:选择凌晨不影响业务的时间拔掉原备机的电源线.

  2. 一些matlab命令

    expand: R = exprnd(MU) returns an array of random numbers chosen from the exponential distribution w ...

  3. Swift UITableView嵌套UICollectionView点击事件冲突(点击事件穿透)

    不管是啥都响应tableviewcell class JYShopCertificationCell: UITableViewCell { override func hitTest(_ point: ...

  4. js 加减乘除以及四舍五入 新写法

    1 四舍五入 eg: (1.23).round() = 1.2 (1.2456).round(3) = 1.246 Number.prototype.round = function (count) ...

  5. JavaSE基础知识(5)—面向对象(5.5 this和super关键字)

    一.this关键字 1.说明 this关键字代表当前类的对象,可以访问本类的属性.方法.构造器注意:谁调用该方法,则this就指谁 2.语法 访问属性: this.属性名 = 值; System.ou ...

  6. 基于角色的访问控制 (RBAC)权限管理

    RBAC(Role-Based Access Control,基于角色的访问控制),就是用户通过角色与权限进行关联.简单地说,一个用户拥有若干角色,每一个角色拥有若干权限.这样,就构造成“用户-角色- ...

  7. Visual Studio连接Oracle数据库

    一.安装Oracle Developer Tools for Visual Studio 2015 其他的什么client一概不要装,装了的直接卸载. 下载时需要登录,如果之前已经注册账号,提醒一下密 ...

  8. FPGA學習筆記(貳)--- 流水燈

    平臺:FPGA黑金开发板 AX301 開發環境:Quartus Prime Version 17.0.0 Build 595 04/25/2017 Standard Edition 引脚配置:鼠標托拉 ...

  9. ftp协议 主动和被动两种模式模式

  10. centos7.5搭建cdh5.13.0

    序言 本文集群搭建为三台机器,cdh版本为5.13.0,以下是安装过程中所用到的软件包等,可以自行下载.一.前期准备1.安装环境 系统:centos7.5/最小安装版本/64位 内存:主节点 --&g ...