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

          常用鏈接

          留言簿(14)

          隨筆檔案(6)

          文章分類(467)

          文章檔案(423)

          相冊

          收藏夾(18)

          JAVA

          搜索

          •  

          積分與排名

          • 積分 - 827233
          • 排名 - 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 
          哦也  回復  更多評論
            
          主站蜘蛛池模板: 凯里市| 西贡区| 镇坪县| 盈江县| 岑溪市| 大埔县| 儋州市| 大兴区| 云霄县| 射洪县| 虎林市| 神池县| 延川县| 深州市| 天镇县| 永春县| 东源县| 保康县| 开江县| 越西县| 周口市| 阿拉尔市| 镇沅| 岳普湖县| 灵台县| 花垣县| 苏州市| 阿拉尔市| 定陶县| 湘潭市| 阿拉善左旗| 漳州市| 个旧市| 无锡市| 洪雅县| 建水县| 聂荣县| 马鞍山市| 万山特区| 武清区| 大庆市|