jspÂÒÂë½â¾ö
jspÂÒÂë½â¾ö(תÔØ)
jspÂÒÂë½â¾ö(תÔØ)
JAVA֪ʶ 2009-04-14 08:49 ÔĶÁ935 ÆÀÂÛ5
GBK±àÂë
GBK±àÂëÊÇÖйúÖƶ©µÄ¡¢µÈͬÓÚUCSµÄеÄÖÐÎıàÂëÀ©Õ¹¹ú¼Ò±ê×¼¡£GBK¹¤×÷С×éÓÚ1995Äê10Ô£¬Í¬Äê12ÔÂÍê³ÉGBK¹æ·¶¡£¸Ã±àÂë±ê×¼¼æÈÝGB2312£¬¹²ÊÕ¼ºº×Ö21003¸ö¡¢·ûºÅ883¸ö£¬²¢Ìṩ1894¸öÔì×ÖÂë룬¼ò¡¢·±Ìå×ÖÈÚÓÚÒ»¿â¡£
UTF-8±àÂë
UTF-8±àÂë¿ÉÒÔͨ¹ýÆÁ±ÎλºÍÒÆλ²Ù×÷¿ìËÙ¶Áд¡£×Ö·û´®±È½Ïʱstrcmp()ºÍwcscmp()µÄ·µ»Ø½á¹ûÏàͬ£¬Òò´ËʹÅÅÐò±äµÃ¸ü¼ÓÈÝÒס£×Ö½ÚFFºÍFEÔÚUTF-8±àÂëÖÐÓÀÔ¶²»»á³öÏÖ£¬Òò´ËËûÃÇ¿ÉÒÔÓÃÀ´±íÃ÷UTF-16»òUTF-32Îı¾£¨¼ûBOM£© UTF-8 ÊÇ×Ö½Ú˳ÐòÎ޹صġ£ËüµÄ×Ö½Ú˳ÐòÔÚËùÓÐϵͳÖж¼ÊÇÒ»ÑùµÄ£¬Òò´ËËüʵ¼ÊÉϲ¢²»ÐèÒªBOM¡£
GB2312
GB2312Ö§³ÖµÄºº×ÖÌ«ÉÙ¡£1995ÄêµÄºº×ÖÀ©Õ¹¹æ·¶GBK1.0ÊÕ¼ÁË21886¸ö·ûºÅ£¬Ëü·ÖΪºº×ÖÇøºÍͼÐηûºÅÇø¡£ºº×ÖÇø°üÀ¨21003¸ö×Ö·û¡£2000ÄêµÄGB18030ÊÇÈ¡´úGBK1.0µÄÕýʽ¹ú¼Ò±ê×¼¡£¸Ã±ê×¼ÊÕ¼ÁË27484¸öºº×Ö£¬Í¬Ê±»¹ÊÕ¼Á˲ØÎÄ¡¢ÃÉÎÄ¡¢Î¬Îá¶ûÎĵÈÖ÷ÒªµÄÉÙÊýÃñ×åÎÄ×Ö¡£ÏÖÔÚµÄPCƽ̨±ØÐëÖ§³ÖGB18030£¬¶ÔǶÈëʽ²úÆ·Ôݲ»×÷ÒªÇó¡£ËùÒÔÊÖ»ú¡¢MP3Ò»°ãÖ»Ö§³ÖGB2312¡£
´ÓASCII¡¢GB2312¡¢GBKµ½GB18030£¬ÕâЩ±àÂë·½·¨ÊÇÏòϼæÈݵģ¬¼´Í¬Ò»¸ö×Ö·ûÔÚÕâЩ·½°¸ÖÐ×ÜÊÇÓÐÏàͬµÄ±àÂ룬ºóÃæµÄ±ê×¼Ö§³Ö¸ü¶àµÄ×Ö·û¡£ÔÚÕâЩ±àÂëÖУ¬Ó¢ÎĺÍÖÐÎÄ¿ÉÒÔͳһµØ´¦Àí¡£Çø·ÖÖÐÎıàÂëµÄ·½·¨ÊǸß×Ö½ÚµÄ×î¸ßλ²»Îª0¡£°´ÕÕ³ÌÐòÔ±µÄ³Æºô£¬GB2312¡¢GBKµ½GB18030¶¼ÊôÓÚË«×Ö½Ú×Ö·û¼¯ (DBCS)¡£
Ò»¡¢JSPÒ³ÃæÏÔʾÂÒÂë
¶þ¡¢±íµ¥Ìá½»ÖÐÎÄʱ³öÏÖÂÒÂë
Èý¡¢Êý¾Ý¿âÁ¬½Ó
´ó¼ÒÔÚJSPµÄ¿ª·¢¹ý³ÌÖУ¬¾³£³öÏÖÖÐÎÄÂÒÂëµÄÎÊÌ⣬¿ÉÄÜÒ»ÖÁÀ§ÈÅ×ÅÄú£¬ÎÒÏÖÔÚ°ÑÎÒÔÚJSP¿ª·¢ÖÐÓöµ½
µÄÖÐÎÄÂÒÂëµÄÎÊÌâ¼°½â¾ö°ì·¨Ð´³öÀ´¹©´ó¼Ò²Î¿¼¡£
Ò»¡¢JSPÒ³ÃæÏÔʾÂÒÂë
ÏÂÃæµÄÏÔʾҳÃæ(display.jsp)¾Í³öÏÖÂÒÂ룺
¶Ô²»Í¬µÄWEB·þÎñÆ÷ºÍ²»Í¬µÄJDK°æ±¾£¬´¦Àí½á¹û¾Í²»Ò»Ñù¡£ÔÒò£º·þÎñÆ÷ʹÓõıàÂ뷽ʽ²»Í¬ºÍä¯ÀÀÆ÷
<html>
<head>
<title>JSPµÄÖÐÎÄ´¦Àí</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<%
out.print("JSPµÄÖÐÎÄ´¦Àí");
%>
</body>
</html>
¶Ô²»Í¬µÄ×Ö·ûÏÔʾ½á¹û²»Í¬¶øµ¼Öµġ£½â¾ö°ì·¨£ºÔÚJSPÒ³ÃæÖÐÖ¸¶¨±àÂ뷽ʽ(gb2312),¼´ÔÚÒ³ÃæµÄµÚÒ»
ÐмÓÉÏ£º
<%@ page contentType="text/html; charset=gb2
Ïà¹ØÎĵµ£º
<script language="javascript">
function window.onunload(){
//ËùÓд°¿Ú¹Ø±Õ
if((window.screenLeft>=10000 && window.screenTop>=10000) || event.altKey)
{ //µã»÷ÓÒÉϽǵĴ°¿Ú¹Ø±Õ
alert("aaaaaaaaaaaaaaaaaa");
}
}
</s ......
JSPÖеÄÌøת£º
(1). forward()·½·¨
ʹÓõ½javax.servlet.RequestDispatcherÀà
RequestDispatcher rd = getServletContext().getRequestDispatcher("url");
rd.forward(requestVar,requestVar); //´«µÝservletµÄÈë¿Ú²ÎÊý
/*forwardº ......
Àý×Ó˵Ã÷£ºÕâÀý×ÓÊÇѧÉú»ù±¾ÐÅÏ¢µÄÊäÈëÒÔ¼°Êä³öÏÔʾ;ÓÐÁ½¸öÒ³Ã棺info.jspºÍshowInfo.jsp£¬Ç°ÕßÊǹ˿ÍÊäÈëµÄÐÅÏ¢Ò³Ã棬¶øºóÕßÊÇ´¦ÀíÐÅÏ¢µÄÒ³Ãæ¡£
info.jsp
<%@page contentType="text/html;charset=gb2312"%>
<HTML>
<HEAD>
<TITLE>ÊäÈëѧ ......
×î½üÔÚѧJAVA£¬Á·Ï°µÄʱºòÓöµ½¸öÎÊÌ⣬Çë´ó¼Ò°ïæ¿´¿´……
Ö÷ÒªÎÊÌâÊÇ£¬ÔÚJSPÖÐûÓа취µ¼ÈëÎÒÏëÓõÄÀ࣬Ã÷Ã÷µ¼ÈëÁË°ü£¬È´±¨£ºMyDAO cannot be resolved to a type
JSP´úÂ룺
<%@ page contentType="text/html;charset=GBK"%>
<%@ page import="java.util.Date"%>
<%@ page import="java.t ......
ÈçºÎÓÃJBoss ......