呆呆向前沖的blog

            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
            78 隨筆 :: 43 文章 :: 5 評論 :: 74 Trackbacks
          三種解決方式如下

          1、可以覆蓋父類ActionServelt 的process 方法(針對服務器)
          在其中加入如下代碼:
          request.setCharacterEncoding ("GB2312");//字符集內碼轉換
          super.process (request, response);//ActionServlet 的處理

          2、針對Validate方法
             native2ascii -encoding GBK ApplicationResources_xx.properties ApplicationResources_zh.properties


          3、提交的中文字符在服務器端(JBOSS)亂碼
          解決辦法:增加一個filter,里面將request中的中文轉換為GBK
          public void doFilter(ServletRequest request, ServletResponse response,
            FilterChain chain) throws IOException, ServletException {
              request.setCharacterEncoding("GBK");
              chain.doFilter(request,response);
          }

          posted on 2005-08-10 23:06 呆呆向前沖的blog 閱讀(342) 評論(0)  編輯  收藏 所屬分類: 工作:Java技術
          主站蜘蛛池模板: 开原市| 崇州市| 大荔县| 镇沅| 大埔区| 毕节市| 宜兰市| 论坛| 洞头县| 科技| 昂仁县| 石泉县| 营山县| 五大连池市| 泰和县| 和林格尔县| 衡南县| 东城区| 武陟县| 华宁县| 新乐市| 定南县| 彝良县| 深州市| 利津县| 屯昌县| 班玛县| 尼勒克县| 云梦县| 德安县| 沾化县| 闽清县| 龙南县| 五莲县| 福建省| 通辽市| 兴仁县| 溧阳市| 黔东| 东莞市| 福建省|