日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

pring MVC过滤器-HttpPutFormContentFilter

發布時間:2025/3/20 55 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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>

?

?

總結

以上是生活随笔為你收集整理的pring MVC过滤器-HttpPutFormContentFilter的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。