呆呆向前沖的blog

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

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

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


          3、提交的中文字符在服務(wù)器端(JBOSS)亂碼
          解決辦法:增加一個filter,里面將request中的中文轉(zhuǎn)換為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 閱讀(348) 評論(0)  編輯  收藏 所屬分類: 工作:Java技術(shù)
          主站蜘蛛池模板: 绥德县| 崇信县| 昭平县| 府谷县| 胶南市| 房产| 洪泽县| 贞丰县| 龙口市| 肇州县| 宁阳县| 武宁县| 巴林右旗| 阿瓦提县| 报价| 景东| 色达县| 元朗区| 泽普县| 广汉市| 固镇县| 青海省| 北流市| 手游| 新野县| 横山县| 庄河市| 合江县| 武强县| 吉首市| 策勒县| 社会| 浦江县| 丹凤县| 峡江县| 略阳县| 秦安县| 宾阳县| 通许县| 万盛区| 湘潭县|