呆呆向前沖的blog

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

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

          2、針對(duì)Validate方法
             native2ascii -encoding GBK ApplicationResources_xx.properties ApplicationResources_zh.properties


          3、提交的中文字符在服務(wù)器端(JBOSS)亂碼
          解決辦法:增加一個(gè)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 閱讀(341) 評(píng)論(0)  編輯  收藏 所屬分類: 工作:Java技術(shù)
          主站蜘蛛池模板: 兰考县| 黄冈市| 曲沃县| 临邑县| 肃北| 光山县| 武冈市| 平罗县| 甘谷县| 上思县| 屏南县| 凌源市| 德保县| 龙井市| 中卫市| 金乡县| 陕西省| 永兴县| 临夏市| 鸡西市| 奉节县| 柏乡县| 永康市| 许昌县| 桂林市| 荔波县| 黄平县| 八宿县| 蒙自县| 富川| 丰县| 勃利县| 蒲城县| 洛阳市| 泗洪县| 本溪| 遂溪县| 广平县| 龙川县| 大洼县| 个旧市|