Javadream

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

          這會拋出一個一異常,因為在params.get("username")返回的是一個字符串數組,所以不能這樣轉換.

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







          Feedback

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

          2008-11-13 21:50 by huojingping
          很好,受益非淺,感謝!
          主站蜘蛛池模板: 扎囊县| 镇赉县| 新绛县| 抚顺市| 兴国县| 渝北区| 太谷县| 将乐县| 彭水| 普陀区| 安丘市| 楚雄市| 大理市| 九龙坡区| 剑阁县| 灵寿县| 西宁市| 合山市| 许昌县| 依兰县| 策勒县| 达尔| 那曲县| 太和县| 阜康市| 明水县| 鄱阳县| 子长县| 文成县| 独山县| 昔阳县| 雷州市| 卓尼县| 牙克石市| 万盛区| 南岸区| 察雅县| 甘洛县| 积石山| 新竹县| 梅河口市|