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

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 loaded on <%= (new java.util.Date()).toLocaleString() %> -->
ÔÚ¿Í»§¶ËµÄHTMLÔ´´úÂëÖÐÏÔʾΪ:
<!-- This page was loaded on January 1, 2000 -->
ÃèÊö
ÕâÖÖ×¢ÊͺÍHTMLÖкÜÏñ£¬Ò²¾ÍÊÇËü¿ÉÒÔÔÚ"²é¿´Ô´´úÂë"Öп´µ½.
ΨһÓÐЩ²»Í¬µÄ¾ÍÊÇ£¬Äã¿ÉÒÔÔÚÕâ¸ö×¢ÊÍÖÐÓñí´ïʽ£¨Àý×Ó2Ëùʾ).Õâ¸ö±í´ïʾÊDz»¶¨µÄ£¬ÓÉÒ³Ã治ͬ¶ø²»Í¬£¬ÄãÄܹ»Ê¹Óø÷ÖÖ±í´ïʽ£¬Ö»ÒªÊǺϷ¨µÄ¾ÍÐС£¸ü¶àµÄÇë¿´±í´ïʽ
Òþ²Ø×¢ÊÍ
дÔÚJSP³ÌÐòÖУ¬µ«²»ÊÇ·¢¸ø¿Í»§¡£
JSP Óï·¨
<%-- comment --%>
Àý×Ó£º
<%@ page language="java" %>
<html>
<head><title>A Comment Test</title></head>
<body>
<h2>A Test of Comments</h2>
<%-- This comment will not be visible in the page source --%>
</body>
</html>
ÃèÊö
ÓÃÒþ²Ø×¢Êͱê¼ÇµÄ×Ö·û»áÔÚJSP±àÒëʱ±»ºöÂÔµô¡£Õâ¸ö×¢ÊÍÔÚÄãÏ£ÍûÒþ²Ø»ò×¢ÊÍÄãµÄJSP³ÌÐòʱÊǺÜÓÐÓõġ£JSP±àÒëÆ÷²»ÊÇ»á¶Ô<%--and--%>Ö®¼äµÄÓï¾ä½øÐбàÒëµÄ£¬Ëü²»»áÏÔʾÔÚ¿Í»§µÄä¯ÀÀÆ÷ÖУ¬Ò²²»»áÔÚÔ´´úÂëÖп´µ½
ÉùÃ÷
ÔÚJSP³ÌÐòÖÐÉùÃ÷ºÏ·¨µÄ±äÁ¿ºÍ·½·¨
JSP Óï·¨
<%! declaration; [ declaration; ]+ ... %>
Àý×Ó
<%! int i = 0; %>
<%! int a, b, c; %>
<%! Circle a = new Circle(2.0); %>
ÃèÊö
ÉùÃ÷Ä㽫ҪÔÚJSP³ÌÐòÖÐÓõ½µÄ±äÁ¿ºÍ·½·¨¡£ÄãÒ²±ØÐëÕâÑù×ö£¬²»È»»á³ö´í.
Äã¿ÉÒÔÒ»´ÎÐÔÉùÃ÷¶à¸ö±äÁ¿ºÍ·½·¨£¬Ö»ÒªÒÔ";"½áβ¾ÍÐУ¬µ±È»ÕâЩÉùÃ÷ÔÚJavaÖÐÒªÊǺϷ¨µÄ¡£
µ±ÄãÉùÃ÷·½·¨»ò±äÁ¿Ê±£¬Çë×¢ÒâÒÔϵÄһЩ¹æÔò:
ÉùÃ÷±ØÐëÒÔ";"½áβ(ScriptletÓÐͬÑùµÄ¹æÔò£¬µ«ÊÇ ±í´ïʽ¾Í²»Í¬ÁË).
Äã¿ÉÒÔÖ±½ÓʹÓÃÔÚ<% @ page %>Öб»°üº¬½øÀ´µÄÒѾ­ÉùÃ÷µÄ±äÁ¿ºÍ·½·¨£¬²»ÐèÒª¶ÔËüÃÇÖØнøÐÐÉùÃ÷.
Ò»¸öÉùÃ÷½öÔÚÒ»¸öÒ³ÃæÖÐÓÐЧ¡£Èç¹ûÄãÏëÿ¸öÒ³Ã涼Óõ½Ò»Ð©ÉùÃ÷£¬×îºÃ°ÑËüÃÇд³ÉÒ»¸öµ¥¶ÀµÄÎļþ£¬È»ºóÓÃ<%@ include %>»ò<jsp:include >ÔªËØ°üº¬½øÀ´¡£
±í´ïʽ
°üº¬Ò»¸


Ïà¹ØÎĵµ£º

301Öض¨ÏòÉèÖü°³ÌÐò´úÂëʵÏÖÈ«¼¯(ASP|.NET|PHP|JSP)

Ê×ÏÈÉêÃ÷£ºÕâ¸öÊÇÎÒתÔصģ¬ÖÂÁ¦ÓÚΪÏñÎÒÒ»ÑùµÄÐÂÊÖÌṩ°ïÖú£¡
1¡¢IISÏÂ301ÉèÖà InternetÐÅÏ¢·þÎñ¹ÜÀíÆ÷ -> ÐéÄâĿ¼ -> Öض¨Ïòµ½URL£¬ÊäÈëÐèҪתÏòµÄÄ¿±êURL£¬²¢Ñ¡Ôñ“×ÊÔ´µÄÓÀ¾ÃÖض¨Ïò”¡£
2¡¢ASPϵÄ301תÏò´úÂë
<%@ Language=VBScript %>
<%
Response.Status=”301 Moved Permanent ......

5ÔÂ19ÈÕ JSP»ù´¡

1.essionÄڵĴæ·ÅµÄÊǶÔÏóµÄÒýÓÃ,ËùÒÔÐÞ¸ÄÄÚÖöÔÏóºó,²»ÐèÒªÖØзÅÖõ½sessionÖÐ
2.ÅäÖÃContext³õʼ»¯²ÎÊý
<Context-param>
<param-name></paran-name>
<param-value></param-value>
<Context-param>
this.getServletContext().getInitParameter(arg0);
--------------------- ......

jsp useBean scopeÊôÐÔµÄÇø·Ö

      scopeÊôÐÔÓÃÓÚÖ¸¶¨JavaBeanʵÀý¶ÔÏóËù´æ´¢µÄÓò·¶Î§£¬ÆäÈ¡ÖµÖ»ÄÜÊÇpage¡¢request¡¢sessionºÍapplicationËĸöÖµÖеÄÒ»¸ö£¬ÆäĬÈÏÖµÊÇpage¡£
      ÎÒ¿ÉÒÔ²âÊÔÏÂÃæ´úÂ룺
date.jsp
---------------------------------------------------------
<jsp:useBean i ......

JSP×Ô¶¨Òå±êÇ©

JSP×Ô¶¨Òå±êÇ©
Ò»£¬    »ù±¾¸ÅÄ
±êÇ©(Tag):±êÇ©ÊÇÒ»ÖÖXMLÔªËØ£¬Í¨¹ý±êÇ©¿ÉÒÔʹJSPÍøÒ³±äµÃ¼ò½àÒ×ÓÚά»¤£¬»¹¿ÉÒÔ·½±ãµØʵÏÖͬһ¸öJSPÎļþÖ§³Ö¶àÖÖÓïÑÔ°æ±¾¡£ÓÉÓÚ±êÇ©ÊÇXMLÔªËØ£¬ËùÒÔËüµÄÃû³ÆºÍÊôÐÔ¶¼ÊÇ´óСдÃô¸ÐµÄ¡£
±êÇ©¿â(Tag library)£ºÓÉһϵÁй¦ÄÜÏàËÆ£¬Âß¼­ÉÏ»¥ÏàÁªÏµµÄ±êÇ©¹¹³ÉµÄ¼¯ºÏ³ÆΪ±êÇ©¿ ......

JSPÄÚÖöÔÏó

JSP µÄÄÚÖöÔÏóÓУºresquest ¡¢response¡¢session¡¢ application ¡¢out¡£ÒÔÏÂÎÒÃǽ«
Ò»Ò»½éÉÜ¡£
response ºÍrequest ¶ÔÏóÊÇJSP µÄÄÚÖöÔÏó½ÏÖØÒªµÄÁ½¸ö£¬ÕâÁ½¸ö¶ÔÏóÌṩÁ˶ԷþÎñ
Æ÷ºÍä¯ÀÀÆ÷ͨÐÅ·½·¨µÄ¿ØÖÆ¡£Ö±½ÓÌÖÂÛÕâÁ½¸ö¶ÔÏóÇ°£¬ÒªÏȶÔHTTP ЭÒé----Word Wide
Webµ×²ãЭÒé×÷¼òµ¥½éÉÜ¡£
Word Wide WebÊÇÔõÑùÔËÐеÄÄØ£ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ