jsp¶ÁÈ¡Êý¾Ý¿âÖÐÎÄÂÒÂëÎÊÌâ
Õâ¸öÎÊÌâÊÇ´ÓÏîÄ¿ÖÐÉè¼ÆÊý¾Ý¿âºÍ²Ù×÷Êý¾Ý¿âµÄÈ˲»Í¬¶øÔì³ÉµÄ¡£ËùÓõÄÊý¾Ý¿â
ÊÇsybase£¬Éè¼Æʱ°ÑÊý¾ÝÀàÐÍÉè¼ÆΪnvarcharÁË£¬Èç¹ûÊÇÖÐÎÄ£¬¶ÁÈ¡³öÀ´¾Í»áµÃ
µ½ÂÒÂë¡£ÎÒÊÔÁ˺ö෽·¨»¹ÊDz»ÐУ¬×îºóÎÞÄΣ¬Ö»ºÃ½«Êý¾ÝÀàÐ͸ÄΪvarcharÁË¡£
ËùÒÔÔÚ´Ë×ܽáÒ»ÏÂÖÐÎÄÂÒÂëÎÊÌâ¡£
Ò»¡¢JSPÓëÒ³Ãæ²ÎÊýÖ®¼äµÄÂÒÂë
JSP»ñÈ¡Ò³Ãæ²ÎÊýʱһ°ã²ÉÓÃϵͳĬÈϵıàÂ뷽ʽ£¬Èç¹ûÒ³Ãæ²ÎÊýµÄ±àÂë
ÀàÐͺÍϵͳĬÈϵıàÂëÀàÐͲ»Ò»Ö£¬ºÜ¿ÉÄܾͻá³öÏÖÂÒÂë¡£½â¾öÕâÀàÂÒÂëÎÊÌâµÄ
»ù±¾·½·¨ÊÇÔÚÒ³Ãæ»ñÈ¡²ÎÊý֮ǰ£¬Ç¿ÖÆÖ¸¶¨request»ñÈ¡²ÎÊýµÄ±àÂ뷽ʽ£º
request.setCharacterEncoding("GBK")»òrequest.setCharacterEncoding
("gb2312")¡£
Èç¹ûÔÚJSP½«±äÁ¿Êä³öµ½Ò³Ãæʱ³öÏÖÁËÂÒÂ룬¿ÉÒÔͨ¹ýÉèÖÃ
response.setContentType("text/html;charset=GBK")»ò
response.setContentType("text/html;charset=gb2312")½â¾ö¡£
¶þ¡¢JavaÓëÊý¾Ý¿âÖ®¼äµÄÂÒÂë
´ó²¿·ÖÊý¾Ý¿â¶¼Ö§³ÖÒÔunicode±àÂ뷽ʽ£¬ËùÒÔ½â¾öJavaÓëÊý¾Ý¿âÖ®¼äµÄ
ÂÒÂëÎÊÌâ±È½ÏÃ÷Öǵķ½Ê½ÊÇÖ±½ÓʹÓÃunicode±àÂëÓëÊý¾Ý¿â½»»¥¡£ºÜ¶àÊý¾Ý¿âÇý¶¯
×Ô¶¯Ö§³Öunicode£¬ÈçMicrosoftµÄSQLServerÇý¶¯¡£ÆäËû´ó²¿·ÖÊý¾Ý¿âÇý¶¯£¬¿ÉÒÔ
ÔÚÇý¶¯µÄurl²ÎÊýÖÐÖ¸¶¨£¬ÈçÈçmmµÄmysqlÇý¶¯£º
jdbc:mysql://localhost/WEBCLDB?useUnicode=true&characterEncoding=GBK¡£
Èý¡¢JavaÓëÎļþ/Á÷Ö®¼äµÄÂÒÂë
Java¶ÁдÎļþ×î³£ÓõÄÀàÊÇFileInputStream/FileOutputStreamºÍ
FileReader/FileWriter¡£ÆäÖÐFileInputStreamºÍFileOutputStreamÊÇ»ùÓÚ×Ö½Ú
Á÷µÄ£¬³£ÓÃÓÚ¶Áд¶þ½øÖÆÎļþ¡£¶Áд×Ö·ûÎļþ½¨ÒéʹÓûùÓÚ×Ö·ûµÄFileReaderºÍ
FileWriter£¬Ê¡È¥ÁË×Ö½ÚÓë×Ö·ûÖ®¼äµÄת»»¡£µ«ÕâÁ½¸öÀàµÄ¹¹Ô캯ÊýĬÈÏʹÓÃϵ
ͳµÄ±àÂ뷽ʽ£¬Èç¹ûÎļþÄÚÈÝÓëϵͳ±àÂ뷽ʽ²»Ò»Ö£¬¿ÉÄÜ»á³öÏÖÂë¡£ ÔÚÕâ
ÖÖÇé¿öÏ£¬½¨ÒéʹÓÃFileReaderºÍFileWriterµÄ¸¸Àࣺ
InputStreamReader/OutputStreamWriter£¬ËüÃÇÒ²ÊÇ»ùÓÚ×Ö·ûµÄ£¬µ«ÔÚ¹¹Ô캯Êý
ÖпÉÒÔÖ¸¶¨±àÂëÀàÐÍ£ºInputStreamReader(InputStream in, Charset cs) ºÍ
OutputStreamWriter(OutputStream out, Charset cs)¡£
×Ö·û£¬×ֽںͱàÂëÖ®¼äµÄ¹Øϵ
1. ±àÂëÎÊÌâµÄÓÉÀ´£¬Ïà¹Ø¸ÅÄîµÄÀí½â
1.1 ×Ö·ûÓë±àÂëµÄ·¢Õ¹
´Ó¼ÆËã»ú¶Ô¶à¹úÓïÑÔµÄÖ§³Ö½Ç¶È¿´£¬´óÖ¿ÉÒÔ·ÖΪÈý¸ö½×¶Î£º
¡¡ ϵͳÄÚÂë
Ïà¹ØÎĵµ£º
·½·¨Ò»£ºÔÚservletµÄinit()·½·¨Öлº´æÊý¾Ý
¡¡¡¡µ±Ó¦Ó÷þÎñÆ÷³õʼ»¯servletʵÀýÖ®ºó£¬Îª¿Í»§¶ËÇëÇóÌṩ·þÎñ֮ǰ£¬Ëü»áµ÷ÓÃÕâ¸öservletµÄinit()·½·¨¡£ÔÚÒ»¸öservlet
µÄÉúÃüÖÜÆÚÖУ¬init()·½·¨Ö»»á±»µ÷ÓÃÒ»´Î¡£Í¨¹ýÔÚinit()·½·¨Öлº´æһЩ¾²Ì¬µÄÊý¾Ý»òÍê³ÉһЩֻÐèÒªÖ´ÐÐÒ»´ÎµÄ¡¢ºÄʱµÄ²Ù×÷£¬¾Í¿É´ó´óµØÌá¸ßϵ
ͳÐÔÄÜ¡£
¡¡ ......
Á½ÄêÇ°£¬ÔøÓÐһλǰ±²¶ÔÎÒ˵¹ý£º¿ª·¢Ò»¸öÊôÓÚÄã×Ô¼ºµÄÍøÕ¾£¬È»ºóÿÌ컨һµã¿ÕÏеÄʱ¼äÈ¥¾ÓªÒ»Ï£¬ÖÕÓÐÒ»Ì죬Äã»á·¢¾õËüÊǷdz£ÓÐÓõġ£¸Õ¿ªÊ¼µÄʱºò£¬ÎÒûÓаÑÕâЩ»°·ÅÔÚÐÄÉÏ£¬ÂýÂýµØ£¬ÎҲŷ¢¾õÕâλǰ±²ËµµÄ»°ÊǺÜÓеÀÀíµÄ¡£¼ÙÉèÁ½ÄêÇ°¿ªÊ¼¾ÓªÒ»¸öÍøÕ¾£¬Í¨¹ýÕâÁ½ÄêµÄÍƹãºÍÔËÓª£¬Ëµ²»¶¨µ½Ï ......
ÄãµÄ¿ì½Ý½¨ÉèÖÃÓÐÎÊÌ⣬ÄãÖØÐÂÉèÖÃÒ»ÏÂÔÚ window --> Perferences--> General--> keys
½«Content Assist¿ì½Ý¼üÉèÖóÉAlt + /¾Í¿ÉÒÔÁË
Èç¹ûÄã·¢ÏÖµãÁËApply¹ØÁËÖ®ºó£¬Ôٴδò¿ªContent AssistµÄ¿ì½Ý¼üûÓиıäµÄ»°£¬ÄÇÊÇÒòΪÏÂÃæÓÐÒ»¸öÑ¡ÏîÒѾÓõ½ÁËAlt + /£¬¾ßÌåÊÇÄÄÒ»¸öÎҼDz»ÇåÁË£¬Äã°ÑÄǸöcommandµÄ¿ì½Ý¼ü¸ ......
ÔËÐÐ×Ô¼ºÅäÖõÄwebÓ¦Óã¬ÍùÍùÖ»ÄÜ¿´¼ûweblogic±àÒëÖ®ºóµÄclassÎļþ¡£¶ø¿´²»¼û±àÒëÇ°µÄjavaµÄÎļþ¡£ÎªÁ˵÷ÊÔ·½±ã£¬ÎÒÃÇÓÐʱºòÊÇÏë¿´±àÒëÇ°µÄjavaÎļþ¡£
ÔÚweblogic.xmlÖмÓÈë
<jsp-descriptor>
<jsp-param>
<param-name>keepgenerated</param-name>
<param-value>true</par ......
<%@ page contentType="text/html; charset=gbk" language="java" import="java.sql.*" errorPage="" %>
<%@ page import="java.io.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w ......