線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1267
推到 Plurk!
推到 Facebook!

如何讓InterWeb for Java正確顯示中文字

尚未結案
dennis
一般會員


發表:9
回覆:5
積分:2
註冊:2002-03-13

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-06-20 09:12:11 IP:210.64.xxx.xxx 未訂閱
請教各位高手 有人使用過IntraWeb for Java可以正確顯示中文字嗎? Designed Time時可以輸入中文字,但是編譯後執行所產 生的網頁裡面只要是中文字就變成? 煩請有用過此元件組的人可以告知如何解決嗎? 感謝 PS:IntraWeb For Java 5.0.6 (JBuilder Edition)
mosla31
一般會員


發表:0
回覆:1
積分:0
註冊:2002-03-19

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-06-26 12:38:45 IP:61.230.xxx.xxx 未訂閱
您可以試試 方法1: 為你的 war 檔加入一個 Filter.. 目的是 res.setContentType("text/html; charset=Big5"); import javax.servlet.*; import javax.servlet.http.*; import java.io.*; public class LoginFilter implements Filter { private FilterConfig filterConfig; // Handle the passed-in FilterConfig public void init(FilterConfig filterConfig) { this.filterConfig = filterConfig; } // Process the request/response pair public void doFilter(ServletRequest req, ServletResponse res, FilterChain filterChain) { try { res.setContentType("text/html; charset=Big5"); filterChain.doFilter(req, res); } catch (ServletException sex) { filterConfig.getServletContext().log(sex.getMessage()); } catch (IOException iox) { filterConfig.getServletContext().log(iox.getMessage()); } } // Clean up resources public void destroy() { } } 方法2: private void jbInit() throws Exception { this.setTitle("IWForm1"); this.setBackgroundColor(new java.awt.Color(13434828,false)); this.setSize(new Dimension(470, 302) ); this.addFormRenderListener(new atozed.iw.event.FormRenderListener() { public void onRender(FormRenderEvent e) { this_onRender(e); } }); iWButton1.setText("測試"); iWButton1.setBounds(new Rectangle(148, 223, 70, 31)); iWButton1.addClickListener(new atozed.iw.event.ClickListener() { public void onClick(ClickEvent e) { iWButton1_onClick(e); } }); iWLabel1.setText("姓名: "); iWLabel1.setFontType(new atozed.iw.lib.IWFont(null,12,null,true,true,false,false,false)); iWLabel1.setBounds(new Rectangle(51, 65, 44, 24)); iWTextField1.setText(""); iWTextField1.setBounds(new Rectangle(114, 61, 125, 27)); this.add(iWLabel1, null); this.add(iWTextField1, null); this.add(iWButton1, null); } void iWButton1_onClick(ClickEvent e) { getWebApplication().showMessage("Hello " iWTextField1.getText(), IWApplication.MESSAGE_ALERT); } void this_onRender(FormRenderEvent e) { getWebApplication().getHTTPResponse().setContentType("text/html;charset=big5"); } ---------------- 不過, 不管以上那種方法都只能暫時顯示正確的中文, 當 Post/Get 後就可 能會顯示錯誤, 因為在 IntraWeb 的各元件已把編碼寫在元件內了, 希望下 一版會改善這個問題! 自己的一點經驗和你分享!
系統時間:2024-05-18 12:05:43
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!