zoukankan      html  css  js  c++  java
  • pring MVC过滤器-HttpPutFormContentFilter

        在Spring MVC过滤器-HiddenHttpMethodFilter中我们提到,jsp或者说html中的form的method值只能为post或get,我们可以通过HiddenHttpMethodFilter获取put表单中的参数-值,而在Spring3.0中获取put表单的参数-值还有另一种方法,即使用HttpPutFormContentFilter过滤器。

            HttpPutFormContentFilter过滤器的作为就是获取put表单的值,并将之传递到Controller中标注了method为RequestMethod.put的方法中。

            在web.xml中配置HttpPutFormContentFilter的代码类似如下:

    <filter>  
        <filter-name>httpPutFormcontentFilter</filter-name>  
        <filter-class>org.springframework.web.filter.HttpPutFormContentFilter</filter-class>  
    </filter>  
    <filter-mapping>  
        <filter-name>httpPutFormContentFilter</filter-name>  
        <url-pattern>/*</url-pattern>  
    </filter-mapping>  

     需要注意的是,该过滤器只能接受enctype值为application/x-www-form-urlencoded的表单,也就是说,在使用该过滤器时,form表单的代码必须如下:

    <form action="" method="put" enctype="application/x-www-form-urlencoded">  
    ......  
    </form>  
     
  • 相关阅读:
    U-Boot新手入门
    安装交叉编译工具
    Makefile 工程管理
    gcc基本用法
    poj 3264 Balanced Lineup
    hdoj 1166 敌兵布阵
    poj 1363 Rails
    poj 1028 Web Navigation
    zoj 3621 Factorial Problem in Base K
    poj1861最小生成树
  • 原文地址:https://www.cnblogs.com/a8457013/p/8260892.html
Copyright © 2011-2022 走看看