首页 > 编程语言 > 详细

SpringMVC框架出现 405 request method post not supported 的解决方法

时间:2017-11-25 18:05:50      阅读:500      评论:0      收藏:0      [点我收藏+]

在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 的解决方法

原文:http://www.cnblogs.com/jype/p/7895864.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!