做外贸网站需要什么条件,西安加盟代理网站建设,开发公司企业管理制度,装修公司名字浏览器form表单只支持GET与POST请求#xff0c;而DELETE、PUT等method并不支持#xff0c;spring3.0添加了一个过滤器#xff0c;可以将这些请求转换为标准的http方法#xff0c;使得支持GET、POST、PUT与DELETE请求#xff0c;该过滤器为HiddenHttpMethodFilter。 Hidden…浏览器form表单只支持GET与POST请求而DELETE、PUT等method并不支持spring3.0添加了一个过滤器可以将这些请求转换为标准的http方法使得支持GET、POST、PUT与DELETE请求该过滤器为HiddenHttpMethodFilter。 HiddenHttpMethodFilter的父类是OncePerRequestFilter它继承了父类的doFilterInternal方法工作原理是将jsp页面的form表单的method属性值在doFilterInternal方法中转化为标准的Http方法即GET,、POST、 HEAD、OPTIONS、PUT、DELETE、TRACE然后到Controller中找到对应的方法。例如在使用注解时我们可能会在Controller中用于RequestMapping(value list, method RequestMethod.PUT)所以如果你的表单中使用的是form methodput那么这个表单会被提交到标了MethodPUT的方法中。 需要注意的是由于doFilterInternal方法只对method为post的表单进行过滤所以在页面中必须如下设置 form action... methodpostinput typehidden name_method valueput /....../form而不是使用form action... methodput....../form同时HiddenHttpMethodFilter必须作用于dispatcher前所以在web.xml中配置HiddenHttpMethodFilter时需参照如下代码filterfilter-nameHiddenHttpMethodFilter/filter-namefilter-classorg.springframework.web.filter.HiddenHttpMethodFilter/filter-class/filterfilter-mappingfilter-nameHiddenHttpMethodFilter/filter-nameservlet-namespring/servlet-name/filter-mappingservletservlet-namespring/servlet-nameservlet-classorg.springframework.web.servlet.DispatcherServlet/servlet-classinit-paramparam-namecontextConfigLocation/param-nameparam-valueclasspath:dispatcher.xml/param-value/init-param/servletservlet-mappingservlet-namespring/servlet-nameurl-pattern*.html/url-pattern/servlet-mapping 同样的作为Filter可以在web.xml中配置HiddenHttpMethodFilter的参数可配置的参数为methodParam值必须为GET,、POST、 HEAD、OPTIONS、PUT、DELETE、TRACE中的一个。