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
          很好,受益非淺,感謝!
          主站蜘蛛池模板: 尼勒克县| 泰顺县| 焉耆| 峡江县| 鹰潭市| 吉安县| 河源市| 淅川县| 永顺县| 荆门市| 光泽县| 枣强县| 武隆县| 台州市| 察隅县| 南安市| 马龙县| 花莲县| 乳山市| 大英县| 淳安县| 永昌县| 吉林市| 微山县| 汉源县| 陇西县| 五原县| 兴化市| 雅安市| 和平县| 商水县| 三亚市| 宁南县| 米易县| 孝昌县| 莱州市| 军事| 尖扎县| 东兰县| 巴彦县| 华亭县|