Solve
(1) Display Chinese JSP page: 〈% @pageContentType = "text/html; chaset=gb2312 "%〉
(2) in the WebLogic under the use of Jstl in the head add: 〈% @page pageencoding= "GBK"%〉
(3) Chinese page submission returns when the parameter value is obtained: 〈%request.setcharacterencoding ("gb2312"); %〉,
You can also use the following method for unified processing, first creating the following class:
/* TODO character encoding filter */package summer.admin; Import Javax.servlet.FilterChain; Import Javax.servlet.ServletRequest; Import Javax.servlet.ServletResponse; Import java.io.IOException; Import Javax.servlet.Filter; Import javax.servlet.http.*; Import javax.servlet.ServletException; Import Javax.servlet.FilterConfig; /** * @author Coldrain * TODO character encoding filter */public class Encodingfilter implements filter{protected Filt Erconfig Filterconfig; Private String targetencoding = "gb2312"; /** * Initializes the filter, and, like a normal servlet, it can also get the initial parameters. * * public void init (Filterconfig config) throws servletexception {this.filterconfig = config; if (Config.getinitparameter ("encoding")!=null) {this.targetencoding = Config.getinitparameter ("encoding"); }/** * For filtering processing, this method is the most important, all filtering processing code is implemented here. */public void Dofilter (ServletRequest srequest, Servletresponse sresponsE, Filterchain chain) throws IOException, servletexception {System.out.println ("encode the request using the following methods: Encoding=" +targeten coding); HttpServletRequest request = (httpservletrequest) srequest; Request.setcharacterencoding (targetencoding); Chain.dofilter (Srequest,sresponse); Send the processing right to the next} public void Setfilterconfig (final filterconfig filterconfig) {This.filterconfig=filtercon Fig }//Destroy filter public void Destroy () {this.filterconfig=null; } } //************************************************************************//
|
Then add the following configuration in the Web.xml file:
〈filter〉〈filter-name〉encoding〈/filter-name〉〈filter-class〉summer.admin.encodingfilter〈/filter-class〉〈init-pa Ram〉〈param-name〉encoding〈/param-name〉〈param-value〉gb2312〈/param-value〉〈/init-param〉〈/filter〉〈filt er-mapping〉〈filter-name〉encoding〈/filter-name〉〈url-pattern〉/*〈/url-pattern〉〈/filter-mapping〉
|
(4) Struts Chinese question: Converts Chinese to Unicode characters, and you can have one batch file for the following:
Set path==%path%; G:\JavaCode\Bug\web\WEB-INF\classes native2ascii messages.properties messages_zh_cn.properties//g:\javacode\bug\w Eb\web-inf\classes represents messages.properties file storage path
|
(5) WebLogic Chinese problem resolution add the following content directly to the Weblogic.xml:
〈charset-params〉〈input-charset〉〈resource-path〉/*〈/resource-path〉〈java-charset-name〉gbk〈/java-charset-name〉 〈/input-charset〉〈/charset-params〉
|
(6) JBuilder Chinese Problem Resolution: Modify User_zh.properties Files (Find in System disk documents and Settings directory):
Add the appropriate font (note: To convert to Unicode characters, such as \u5b8b\u4f53 for Arial):
Editor.display; Fixed_fonts.1=courier New Editor.display; Fixed_fonts.10=times New Roman Editor.display; Fixed_fonts.2=lucida Sans typewriter Editor.display; fixed_fonts.3=\u4eff\u5b8b_gb2312 Editor.display; Fixed_fonts.4=\u5b8b\u4f53 Editor.display; Fixed_fonts.5=\u65b0\u5b8b\u4f53 Editor.display; Fixed_fonts.6=\u65b0\u7d30\u660e\u9ad4 Editor.display; fixed_fonts.7=\u6977\u4f53_gb2312 Editor.display; Fixed_fonts.8=\u7d30\u660e\u9ad4 Editor.display; Fixed_fonts.9=\u9ed1\u4f53 Editor.display; Font_family=\u5b8b\u4f53 Editor.display; Font_size=13
|