Javadream

          A long way and a dream.
          看下面這段代碼:
          ActionContext?context?=?ActionContext.getContext();
          Map?params?
          =?context.getParameters();
          String?username?
          =?(String) params.get("username");

          這會拋出一個一異常,因為在params.get("username")返回的是一個字符串?dāng)?shù)組,所以不能這樣轉(zhuǎn)換.

          正確的做法是:
          String username = ((String[])params.get("username"))[0];







          Feedback

          # re: WebWork中利用ActionContext得到Parameter,moxie的教程有誤!  回復(fù)  更多評論   

          2008-11-13 21:50 by huojingping
          很好,受益非淺,感謝!
          主站蜘蛛池模板: 青河县| 卢湾区| 峨边| 金湖县| 宾川县| 右玉县| 台湾省| 张北县| 铜陵市| 阳谷县| 岫岩| 东乌珠穆沁旗| 襄垣县| 达拉特旗| 平江县| 读书| 金阳县| 偃师市| 陆河县| 武陟县| 灵石县| 民勤县| 峨山| 罗甸县| 金乡县| 金寨县| 江油市| 栖霞市| 晋中市| 佛冈县| 尉犁县| 安化县| 酒泉市| 克东县| 三原县| 务川| 山阴县| 盘锦市| 滁州市| 将乐县| 泰安市|