<Connector port="8080"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
debug="0" connectionTimeout="20000"
disableUploadTimeout="true" URIEncoding="GBK"/>
就是在server.xml配置文件中加入 URIEncoding=“GBK”這句話。
現歸納一下Java中文問題,
1、頁面中文顯示,設置<meta http-equiv="content-type" content="text/html; charset=GBK">即可
2、Response用流向頁面輸出中文,要設置Response的字符集response.setCharaterEncoding(”GBK”)
如果使用PrintWriter輸出中文,只要設置<meta http-equiv="content-type" content="text/html; charset=gb2312">
3、提交中文,對于Tomcat就是使用開頭的方法,對于Weblogic,可以使用一個Filter,在Filter里面,設置Request的字符集,request.setCharaterEncoding(”GBK”)
4、如果用的不是JSP做輸出頁面,而是Velocity,要在velocity.properties中設置
velocimacro.library = webwork.vm, tigris-macros.vm
input.encoding=GBK
output.encoding=GBK
default.contentType=text/html; charset=GBK
5、萬能轉換,String str = new String(”中文”.getBytes(”GBK”),”iso-8859-1”);
上面的方法把GBK字符輸出到iso-8859-1字符集的頁面
文章來源于領測軟件測試網 http://www.kjueaiud.com/
版權所有(C) 2003-2010 TestAge(領測軟件測試網)|領測國際科技(北京)有限公司|軟件測試工程師培訓網 All Rights Reserved
北京市海淀區中關村南大街9號北京理工科技大廈1402室 京ICP備10010545號-5
技術支持和業務聯系:info@testage.com.cn 電話:010-51297073
老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月