為什么struts一個界面用戶輸入中文,但是 傳遞給另一個界面時卻只能得到一串????。傳英文就沒有問題
問:為什么struts一個界面用戶輸入中文,但是 傳遞給另一個界面時卻只能得到一串????。傳英文就沒有問題 。答:
要作轉換
public String chStr(String str) {
??????? if (str==null) {str=""; }
??????? else {
??????????????? try { str=(new String (str.getBytes("iso-8859-1"),"GB2312")).trim();
??????????????? } catch (Exception e) {
??????????????????????? System.out.println("chStr");
??????????????????????? System.out.println(e.getMessage());
??????????????? }
??????? }
??????? return str;
???? }
?
posted @ 2006-05-28 23:10 凌寒 閱讀(192) | 評論 (0) | 編輯 收藏