JSP/ServletµÄ±àÂëÔÀí
JSP/ServletµÄ±àÂëÔÀí
¹Ø¼ü×Ö: jsp, servlet±àÂë
Ê×ÏÈ£¬ËµËµ JSP/Servlet Öеļ¸¸ö±àÂëµÄ×÷ÓÃ
ÔÚ JSP/Servlet ÖÐÖ÷ÒªÓÐÒÔϼ¸ÖÖÉèÖñàÂëµÄ·½Ê½£º
pageEncoding ="UTF-8"
contentType = "text/html;charset=UTF-8"
request.setCharacterEncoding("UTF-8")
response.setCharacterEncoding("UTF-8")
ÆäÖÐÇ°Á½¸öÖ»ÄÜÓÃÓÚJSP ÖУ¬¶øºóÁ½¸ö¿ÉÒÔÓÃÓÚ JSP ºÍ Servlet ÖС£
1¡¢pageEncoding="UTF-8" µÄ×÷ÓÃÊÇÉèÖà JSP ±àÒë³É Servlet ʱʹÓõıàÂë
ÖÚËùÖÜÖª£¬JSP ÔÚ·þÎñÆ÷ÉÏÊÇÒªÏȱ»±àÒë³É Servlet µÄ¡£pageEncoding="UTF-8" µÄ×÷ÓþÍÊǸæËß JSP ±àÒëÆ÷ÔÚ½« JSP Îļþ±àÒë³É Servlet ʱʹÓõıàÂ롣ͨ³££¬ÔÚ JSP ÄÚ²¿¶¨ÒåµÄ×Ö·û´®£¨Ö±½ÓÔÚ JSP Öж¨Ò壬¶ø²»ÊÇ´Óä¯ÀÀÆ÷Ìá½»µÄÊý¾Ý£©³öÏÖÂÒÂëʱ£¬ºÜ¶à¶¼ÊÇÓÉÓڸòÎÊýÉèÖôíÎóÒýÆðµÄ¡£ÀýÈ磬ÄãµÄJSP ÎļþÊÇÒÔGBK Ϊ±àÂë±£´æµÄ£¬¶øÔÚJSP ÖÐÈ´Ö¸¶¨pageEncoding="UTF-8" £¬¾Í»áÒýÆðJSP ÄÚ²¿¶¨ÒåµÄ×Ö·û´®ÎªÂÒÂë¡£
ÁíÍ⣬¸Ã²ÎÊý»¹ÓÐÒ»¸ö¹¦ÄÜ£¬¾ÍÊÇÔÚJSPÖв»Ö¸¶¨ contentType ²ÎÊý£¬Ò²²»Ê¹ÓÃresponse.setCharacterEncoding ·½·¨Ê±£¬Ö¸¶¨¶Ô·þÎñÆ÷ÏìÓ¦½øÐÐÖØбàÂëµÄ±àÂë¡£
2¡¢contentType="text/html;charset=UTF-8" µÄ×÷ÓÃÊÇÖ¸¶¨¶Ô·þÎñÆ÷ÏìÓ¦½øÐÐÖØбàÂëµÄ±àÂë
ÔÚ²»Ê¹Óà response.setCharacterEncoding ·½·¨Ê±£¬ÓøòÎÊýÖ¸¶¨¶Ô·þÎñÆ÷ÏìÓ¦½øÐÐÖØбàÂëµÄ±àÂë¡£
3¡¢ request.setCharacterEncoding("UTF-8") µÄ×÷ÓÃÊÇÉèÖöԿͻ§¶ËÇëÇó½øÐÐÖØбàÂëµÄ±àÂë¡£
¸Ã·½·¨ÓÃÀ´Ö¸¶¨¶Ôä¯ÀÀÆ÷·¢ËÍÀ´µÄÊý¾Ý½øÐÐÖØбàÂ루»òÕß³ÆΪ½âÂ룩ʱ£¬Ê¹ÓõıàÂë¡£
4¡¢ response.setCharacterEncoding("UTF-8") µÄ×÷ÓÃÊÇÖ¸¶¨¶Ô·þÎñÆ÷ÏìÓ¦½øÐÐÖØбàÂëµÄ±àÂë¡£
·þÎñÆ÷ÔÚ½«Êý¾Ý·¢Ë͵½ä¯ÀÀÆ÷Ç°£¬¶ÔÊý¾Ý½øÐÐÖØбàÂëʱ£¬Ê¹ÓõľÍÊǸñàÂë¡£
Æä´Î£¬ÒªËµÒ»Ëµä¯ÀÀÆ÷ÊÇÔõôÑù¶Ô½ÓÊպͷ¢Ë͵ÄÊý¾Ý½øÐбàÂëµÄ
response.setCharacterEncoding("UTF-8") µÄ×÷ÓÃÊÇÖ¸¶¨¶Ô·þÎñÆ÷ÏìÓ¦½øÐÐÖØбàÂëµÄ±àÂ롣ͬʱ£¬ä¯ÀÀÆ÷Ò²ÊǸù¾ÝÕâ¸ö²ÎÊýÀ´¶ÔÆä½ÓÊÕµ½µÄÊý¾Ý½øÐÐÖØбàÂ루»òÕß³ÆΪ½âÂ룩¡£ËùÒÔÔÚÎÞÂÛÄãÔÚ JSP ÖÐÉèÖà response.setCharacterEncoding("UTF-8") »òÕßresponse.se
Ïà¹ØÎĵµ£º
Ê×ÏÈÉêÃ÷£ºÕâ¸öÊÇÎÒתÔصģ¬ÖÂÁ¦ÓÚΪÏñÎÒÒ»ÑùµÄÐÂÊÖÌṩ°ïÖú£¡
1¡¢IISÏÂ301ÉèÖà InternetÐÅÏ¢·þÎñ¹ÜÀíÆ÷ -> ÐéÄâĿ¼ -> Öض¨Ïòµ½URL£¬ÊäÈëÐèҪתÏòµÄÄ¿±êURL£¬²¢Ñ¡Ôñ“×ÊÔ´µÄÓÀ¾ÃÖض¨Ïò”¡£
2¡¢ASPϵÄ301תÏò´úÂë
<%@ Language=VBScript %>
<%
Response.Status=”301 Moved Permanent ......
ÖÕÓڸ㶨JSPÁ¬½ÓSQL Server 2000Êý¾Ý¿âµÄÎÊÌâÁË
2008Äê01ÔÂ29ÈÕ ÐÇÆÚ¶þ 15:54
Ç°¼¸Ì죬ƽƽͬѧһֱÔÚ¸ãJSP Á¬½ÓSQL Server 2000Êý¾Ý¿âµÄÎÊÌ⣬һֱÁ¬²»ÉÏ£¬È»ºó½ÐÎÒÈ¥°ïËû¿´¿´£¬Æ¾×ÅÒÔÇ°µÄ¾Ñ飬¸ãÁËÒ»¸öÏÂÎ磬ºÙºÙ£¡ÖÕÓÚ°ïËûÁ¬½ÓÉÏÁË£¬Ö÷Òª²½ÖèÈçÏ£º
1¡¢ÐèÒªµÄ¶«Î÷´ó¼Ò¿ÉÒÔµ½Î ......
Ò»°ãµÄÍøÒ³¶¼ÓÐÕâÖÖ¹¦ÄÜ£ºÔÚÒ³ÃæÉ϶¯Ì¬ÏÔʾµ±Ç°Ê±¼ä£¬Õâ¸öµÄʵÏÖÒ²ºÜ¼òµ¥£¬»ù±¾ÉÏÒ»ÐдúÂë¾ÍʵÏÖÁË
<span id="curTime"></span>
<script type="text/javascript"><!--
setInterval("curTime.innerHTML=new Date().toLocaleString()+' ÐÇÆÚ'+'ÈÕÒ»¶þÈýËÄÎåÁù'.charAt(new Date().getDay());",1000 ......
½ñÌì¿´µ½Á˹«Ë¾ÒÔÓеÄÏîÄ¿ÀïÃæÓÐÖ±½Óͨ¹ýjsp£¨table£©µ¼³öΪexcel±¨±íµÄÓ¦Ó㬸оõºÜÐÂÆ棬ÒÔÓÐ×öµ¼³öexcel¶¼»áÓÃjava´úÂëд£¬Óõ½×¨ÃŵÄÀà¿â£¬²Ù×÷excelÄ£°å£¬ºÜ¸´ÔÓ£¬ÓÃÕâ¸ö·½·¨£¬¿ÉÄܵõ½µÄ±í¸ñûÓÐÄÇô¾«È·£¬µ«¼òµ¥¸ßЧ£¬Ó¦¸ÃÊÇÒ»¸ö²»´íµÄÓ¦Óá£ÏÂÃæµÄÍøÉϱðµÄͬȥµÄһƪÎÄÕ£¬ÕâÀïÕ³Á˹ýÀ´£¬ºÃ¼Çס£¬ÌØ´ËÉùÃ÷¡£
JSPÓ¦ ......
HTML ×¢ÊÍ
ÔÚ¿Í»§¶ËÏÔʾһ¸ö×¢ÊÍ.
JSP Óï·¨
<!-- comment [ <%= expression %> ] -->
Àý×Ó 1
<!-- This file displays the user login screen -->
ÔÚ¿Í»§¶ËµÄHTMLÔ´´úÂëÖвúÉúºÍÉÏÃæÒ»ÑùµÄÊý¾Ý£º
<!-- This file displays the user login screen -->
Àý×Ó 2
<!-- This page was ......