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 ÕûÌå¼ÓÔعý³ÌÈçÏÂ
1¡¢Web·þÎñÆ÷½ÓÊÜrequest¡£
2¡¢ÇëÇ󷢸øServletÒýÇ棬Èç¹ûÒѾ¼ÓÔØservlet£¬class ÔòÖ±½ÓÖ´ÐУ¬·ñÔò´ÓÓ²ÅÌÖвéÕÒclass ¼ÓÔؽøÀ´¡£
3¡¢Ö´ÐÐService·½·¨´¦ÀíÇëÇ󣬲¢·µ»Ø¸øweb·þÎñÆ÷¡£
4¡¢web·þÎñÆ÷·µ»Ø¸ø¿Í»§¶Ë¡£
ServletµÄ¼Ì³Ð¹ØϵΪ
Servlet &n ......
<script language="javascript">
var times=6;
clock();
function clock()
{
window.setTimeout('clock()',1000);
times=times-1;
time.innerHTML =times;
}
</script>
<head>
<meta http-equiv= "Refresh" content= "5;url=index.jsp "& ......
ÄãµÄ¿ì½Ý½¨ÉèÖÃÓÐÎÊÌ⣬ÄãÖØÐÂÉèÖÃÒ»ÏÂÔÚ 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 ......