Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

JSP»ù´¡

Ò»¡¢JSP¼ò½é
JSP (Java Server Pages)ÊÇ·þÎñÆ÷¶ËµÄ½Å±¾ÓïÑÔ£¬ÊÇÒ»ÖÖÔÚHTMLÒ³ÃæÖмÓÈëJavaÓïÑÔ¶øÉú³É¶¯Ì¬Ò³ÃæµÄ¼¼Êõ£º¼ÓÈëÁËеıêÇ©£¨<%£¬%>£¬…£©¡£
JSPÊÇÒÔJavaºÍServletΪ»ù´¡¿ª·¢¶ø³ÉµÄ¶¯Ì¬ÍøÒ³Éú³É¼¼Êõ£¬ËüµÄµ×²ãʵÏÖÊÇJava Servlet¡£
JSPÒ³ÃæÓÉHTML´úÂëºÍǶÈëÆäÖеÄJava´úÂëËù×é³É¡£·þÎñÆ÷ÔÚÒ³Ãæ±»¿Í»§¶ËËùÇëÇóÒÔºó¶ÔÕâЩJava´úÂë½øÐд¦Àí£¬È»ºó½«Éú³ÉµÄHTMLÒ³Ãæ·µ»Ø¸ø¿Í»§¶ËµÄä¯ÀÀÆ÷¡£
¶þ¡¢JSPµÄÖ´Ðйý³Ì
¿Í»§¶ËÇëÇóJSPÒ³Ãæ——>JSP Parser½âÎö*.jsp±àÒëΪ*.java——>javacÃüÁî±àÒë³É*.class——>Ö´ÐÐclassÎļþ——>ÏìÓ¦·µ»Ø½á¹û¸ø¿Í»§¶Ë
JSP´úÂëÖаüº¬JSPÔªËغÍTemplate dataÁ½Àà¡£Template dataÖ¸µÄÊÇJSPÒýÇæ²»´¦ÀíµÄ²¿·Ö£¬¾ÍÊÇJSPÒýÇæ»á°Ñ³ýÔÚ±ê¼Ç<%...%>ÒÔÍâµÄ²¿·ÖÖ±½Ó´«µÝ³öÈ¥¶ø²»½øÐÐÈκδ¦Àí¡£
JSPÔÚµÚÒ»´Î»òÐÞ¸ÄJSPÎļþºóÖ´Ðж¼»áµ÷ÓÃJSP Parser½«*.jspÎļþ±àÒë³Éservlet³ÌÐò£¬ËùÒÔ»á±È½ÏÂý¡£
Èý¡¢JSP»ù±¾Óï·¨
1. Á½ÖÖ×¢ÊÍÀàÐÍ
(1)HTML×¢ÊÍ
¿ÉÒÔÔÚJSP´úÂëÖÐÌí¼ÓÒ»¶ÎHTML¸ñʽµÄ×¢ÊÍ£¬´Ë×¢ÊÍ·¢Éúµ½¿Í»§¶Ë£¬µ«²»ÔÚÒ³ÃæÉÏÏÔʾ£¬Óï·¨ÈçÏ£º
<!-- HTML¸ñʽµÄ×¢ÊÍ£¬ÔÚ¿Í»§¶Ë²é¿´Ô´´úÂëʱ¿É¼û -->
<!-- ´Ë×¢ÊÍÓÉ<%=programmer%>Ìí¼Ó-->
Èç¹ûprogrammerΪhackiller£¬ÔòÔÚ¿Í»§¶Ë·µ»ØµÄ×¢ÊÍÊÇ<!-- ´Ë×¢ÊÍÓÉhackillerÌí¼Ó-->
(2)JSP×¢ÊÍ
дÔÚJSP´úÂëÖУ¬µ«²»·¢Ë͵½¿Í»§¶Ë¡£
<%-- JSP×¢ÊÍ£¬¸Ã×¢ÊÍ»áÔÚJSP±àÒëʱ±»ºöÂÔµô --%>
<%-- /*ScriptletÖеĶàÐÐ×¢ÊÍ*/ --%>
<%-- /**ScriptletÖеĶàÐÐ×¢ÊÍ£¬¿ÉÒÔÓÃjavadoc´ÓjavaÎļþÖÐÌáÈ¡³öÀ´*/ --%>
<%-- JSPµÄµ¥ÐÐ×¢ÊÍ --%>
2. 3¸ö½Å±¾ÔªËØ
(1)ÉùÃ÷(Declaration)È«¾Ö±äÁ¿
<%! int i=0; String str="Hello World!"; %>
(2)±í´ïʽ(Expression)
ÔÚJSP´úÂëÖУ¬¾­³£Ê¹Óñí´ïʽÀ´Êä³ö±äÁ¿µÄÖµ£¬¿ÉÒÔÔÚÈκεط½
<%! int a=1; int b=2; String str="Hello World!"; %>
<%=a+b%>  <%=str>
PS:²»ÄÜÓÓ;”ºÅÀ´×÷Ϊ±í´ïʽµÄ½áÊø·û¡£µ«Í¬ÑùµÄ±í´ïʽÔÚScriptletÖбØÐëÒÔ·ÖºÅÀ´½áβ¡£
(3)½Å±¾¶Î(Scriptlet)
½Å±¾¶ÎÓÃÀ´°üº¬Ò»¸öÓÐЧµØJava³ÌÐò¶Î
<% int b=3; %>¾Ö²¿±äÁ¿
3. 3¸öÖ¸ÁîÔªËØ
(1)pageÖ¸Áî
<%@ page contentType="text/html;charset=utf-8"%>
¶¨ÒåJSPÎļþµÄÈ«¾ÖÊôÐÔ£¬ÊôÐÔ°üÀ¨£ºlanguage¡¢exte


Ïà¹ØÎĵµ£º

JSP·ÖÒ³¼¼ÊõʵÏÖ

title: JSP·ÖÒ³¼¼ÊõʵÏÖ
summary:ʹÓù¤¾ßÀàʵÏÖͨÓ÷ÖÒ³´¦Àí
author: evan_zhao
email: evan_zhao@hotmail.com
¡¡¡¡Ä¿Ç°±È½Ï¹ã·ºÊ¹ÓõķÖÒ³·½Ê½Êǽ«²éѯ½á¹û»º´æÔÚHttpSession»òÓÐ״̬beanÖУ¬·­Ò³µÄʱºò´Ó»º´æÖÐÈ¡³öÒ»Ò³Êý¾ÝÏÔʾ¡£ÕâÖÖ·½·¨ÓÐÁ½¸öÖ÷ÒªµÄȱµã£ºÒ»ÊÇÓû§¿ÉÄÜ¿´µ½µÄÊǹýÆÚÊý¾Ý£»¶þÊÇÈç¹ûÊ ......

Êý¾ÝÊäÈë¼°Êä³öÏÔʾ——JSPʵÓÃÀý×Ó

Àý×Ó˵Ã÷£ºÕâÀý×ÓÊÇѧÉú»ù±¾ÐÅÏ¢µÄÊäÈëÒÔ¼°Êä³öÏÔʾ;ÓÐÁ½¸öÒ³Ã棺info.jspºÍshowInfo.jsp£¬Ç°ÕßÊǹ˿ÍÊäÈëµÄÐÅÏ¢Ò³Ã棬¶øºóÕßÊÇ´¦ÀíÐÅÏ¢µÄÒ³Ãæ¡£
info.jsp
 <%@page contentType="text/html;charset=gb2312"%>
 <HTML>
    <HEAD>
    <TITLE>ÊäÈëѧ ......

jspÂÒÂëÎÊÌâ

jspÂÒÂëÎÊÌ⣬ÇóÖú
ÏÂÁ˸ö¼¸ÄêÇ°µÄjspÔ´Â룬ÎÒ×°ÉϺóÒ»Ö±ÓÐÖÐÎÄÂÒÂëÎÊÌ⣬Êý¾Ý¿âÎÒÓÃmysql£¬
 
²¢ÓÃsql-front²Ù×÷£¬ÔÚÓÃsql-frontµÄʱºòÒÑ°Ñ×Ö·ûÉèÖÃΪgb2312£¬
 
¶øÇÒÔÚsql-frontÖÐÄÜÕýÈ·ÏÔʾÖÐÎÄ£¬µ«¾ÍÊÇÔÚjspÒ³ÃæÉÏÓÃgetstring·½·¨
 
µÃµ½ÂÒÂ룬ÎÒÒ²Óùýgetbytes£¨iso-8859-1£©µÈ·½·¨ÊÔ¹ý»¹ÊÇûÓÐ ......

ÈçºÎÓÃJBoss ÔËÐÐÏà¹ØµÄJSP³ÌÐò

                                                 ÈçºÎÓÃJBoss ......

jspÂÒÂë½â¾ö

jspÂÒÂë½â¾ö(תÔØ)
jspÂÒÂë½â¾ö(תÔØ)
JAVA֪ʶ   2009-04-14 08:49   ÔĶÁ935   ÆÀÂÛ5  
GBK±àÂë
GBK±àÂëÊÇÖйúÖƶ©µÄ¡¢µÈͬÓÚUCSµÄеÄÖÐÎıàÂëÀ©Õ¹¹ú¼Ò±ê×¼¡£GBK¹¤×÷С×éÓÚ1995Äê10Ô£¬Í¬Äê12ÔÂÍê³ÉGBK¹æ·¶¡£¸Ã±àÂë±ê×¼¼æÈÝGB2312£¬¹²ÊÕ¼ºº×Ö21003¸ö¡¢·ûºÅ883¸ö£¬²¢Ìṩ1 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ