Spring MVC过滤器-HttpPutFormContentFilter
2015-12-04 10:59
661 查看
在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>
相关文章推荐
- Apache httpd configuration for IE7 standard mode rendering in IE8(转)——360浏览器兼容模式无法正确展示网页
- Spring MVC过滤器-HiddenHttpMethodFilter
- 嵌入式Linux网络编程(一)
- 常见HTTP状态码
- HTTPS 通信流程(签名、数字证书)
- HTTP 错误405.0 - Method Not Allowed
- 在内部网络为edX配置视频服务
- hdu 4292 Food 网络流
- 从Linux内核中获取TCP数据包到用户程序。
- 重霾锁城 数据中心如何应对空气污染?
- http://blog.163.com/zhaoyanping_1125/blog/static/20132915320120711355117/
- httpclient基础
- Android中获取网络图片的三种方法
- TCP,IP详解,卷一:协议学习笔记之第二章链路层
- 脉络清晰的BP神经网络讲解,赞
- 脉络清晰的BP神经网络讲解,赞
- HTTPS和HTTP的区别
- Nginx配置SSL证书部署HTTPS网站
- CNN网络提取哪层输出作为最后提取的特征为宜?
- iOS 网络与多线程--4.同步Post方式的网络请求