主要有三個問題:
1、struts
中資源檔案中如果value為中文,顯示亂碼。
解決辦法:使用eclipse外掛程式properties editor
2、在文字域裡輸入中文顯示亂碼。
解決辦法:使用servlet過濾器filter
最簡單的可以借用tomcat
下面的filters.setcharacterencodingfilter在自己的
web
.xml配置中加入tomcat中servlet_examples相應配置(高手可以自己配!)。
本人配置如下:
setcharacterencoding
filters.setcharacterencodingfilter
encoding
gbksetcharacterencoding
*.do
3、從某些資料庫裡讀出亂碼。
解決辦法:把你要顯示成中文的部分重新編碼。
例如:while (rs.next())
{string col1 = rs.getstring(1);
string col2 = rs.getstring(2);
string col3 = rs.getstring(3);
float col4 = rs.getfloat(4);
//convert character encoding
col1=new string(col1.getbytes("iso-8859-1"),"gb2312");
col2=new string(col2.getbytes("iso-8859-1"),"gb2312");
col3=new string(col3.getbytes("iso-8859-1"),"gb2312");
}
Java開發工具之Eclipse
eclipse 1 eclipse 發展歷史 發展初期 jbuilder 收費 貴 ibm 2001年 第一版本 開源專案eclipse原始碼 4000萬美元 經過開源社群的努力 2003年3月發布2.1版本 大量程式設計師放棄jbuilder 轉向 ecplise eclipse 特點 一切皆外掛...
eclipse工具下hadoop環境搭建
eclipse工具下hadoop環境搭建 window10作業系統中搭建eclipse64開發系統,配置hadoop的eclipse外掛程式,讓eclipse可以檢視hdfs中的檔案內容。1 將hadoop eclipse plugin 2.5.2.jar檔案移動到eclipse的plugins資料...
Eclipse下開發Struts完整解決亂碼問題
eclispe下開發struts亂碼問題非常令人頭疼,下面給出幾種解決方法 主要有三個問題 1.struts中資源檔案中如果value為中文,顯示亂碼 解決辦法 使用eclipse外掛程式properties editor 更新站點http propedit.sourceforge.jp eclip...