隨筆 - 6  文章 - 129  trackbacks - 0
          <2025年6月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          常用鏈接

          留言簿(14)

          隨筆檔案(6)

          文章分類(467)

          文章檔案(423)

          相冊

          收藏夾(18)

          JAVA

          搜索

          •  

          積分與排名

          • 積分 - 827351
          • 排名 - 49

          最新評論

          閱讀排行榜

          評論排行榜

          web.xml文件
          <?xml version="1.0" encoding="UTF-8"?>
          <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
           version="2.4">

              <filter>
                <filter-name>CharacterEncodingFilter</filter-name>
                <filter-class>
                     org.springframework.web.filter.CharacterEncodingFilter
                </filter-class>
                init-param>
                 <param-name>encoding</param-name>
                 <param-value>GB2312</param-value>
                </init-param>
                <init-param>
                 <param-name>forceEncoding</param-name>
                 <param-value>true</param-value>
                </init-param>
               </filter>
          <!-- 要過濾得類型 -->
            <filter-mapping>
            <filter-name>SetCharacterEncoding</filter-name>
            <url-pattern>*.jsp</url-pattern>
            </filter-mapping>

          </web-app>
          public class CharacterEncodingFilter
          extends OncePerRequestFilter
          
          

          Servlet 2.3/2.4 Filter that allows one to specify a character encoding for requests. This is useful because current browsers typically do not set a character encoding even if specified in the HTML page or form.

          This filter can either apply its encoding if the request does not already specify an encoding, or enforce this filter's encoding in any case ("forceEncoding"="true"). In the latter case, the encoding will also be applied as default response encoding on Servlet 2.4+ containers (although this will usually be overridden by a full content type set in the view).



          posted on 2007-09-12 23:27 Ke 閱讀(3216) 評論(1)  編輯  收藏 所屬分類: spring

          FeedBack:
          # re: org.springframework.web.filter.CharacterEncodingFilter 2008-10-24 19:37 
          哦也  回復  更多評論
            
          主站蜘蛛池模板: 绥中县| 读书| 临夏县| 嘉禾县| 金溪县| 台东市| 会东县| 平乡县| 永嘉县| 乐业县| 南江县| 普洱| 白山市| 桂阳县| 中牟县| 永福县| 新郑市| 利辛县| 东平县| 辽中县| 准格尔旗| 新宾| 儋州市| 来安县| 襄汾县| 普定县| 逊克县| 澄城县| 绍兴县| 美姑县| 锡林郭勒盟| 永泰县| 凤翔县| 昔阳县| 岗巴县| 聂拉木县| 兴城市| 余姚市| 兖州市| 岐山县| 玛沁县|