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

Jsp±àÂë¹æ·¶


Jsp±àÂë¹æ·¶
1.1 Îļþºó׺(File Suffixes)
ÎļþÀà±ð ¡¡¡¡ ¡¡¡¡¡¡¡¡¡¡Îļþºó׺
--------------------------------------
JavaÔ´Îļþ¡¡¡¡¡¡¡¡¡¡¡¡¡¡.java
Java×Ö½ÚÂëÎļþ¡¡¡¡¡¡¡¡¡¡.class
¶¯Ì¬Ò³Ãæ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡.jsp
¾²Ì¬Ò³Ãæ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡.html
½Å±¾Îļþ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡.js
1.2 ³£ÓÃÎļþÃû(Common File Names)
ÎļþÃû ¡¡¡¡¡¡ ¡¡¡¡¡¡¡¡¡¡¡¡ ÓÃ;
------------------------------------------------
README¡¡¡¡¡¡¡¡¡¡¡¡ ¸ÅÊöÌض¨Ä¿Â¼ÏÂËùº¬ÄÚÈݵÄÎļþµÄÊ×Ñ¡ÎļþÃû
2 Ëõ½øÅÅ°æ(Indentation)
4¸ö¿Õ¸ñ³£±»×÷ΪËõ½øÅÅ°æµÄÒ»¸öµ¥Î»¡£Ëõ½øµÄÈ·ÇнâÊͲ¢Î´Ïêϸָ¶¨(¿Õ¸ñ vs. ÖƱí·û)¡£Ò»¸öÖƱí·ûµÈÓÚ8¸ö¿Õ¸ñ(¶ø·Ç4¸ö)¡£
3 ×¢ÊÍ(Comments)
Jsp³ÌÐòÓÐÁ½Àà×¢ÊÍ£º¾²Ì¬Ò³Ãæ×¢ÊͺÍJava×¢ÊÍ.
¾²Ì¬Ò³Ãæ×¢ÊÍ: <!— express -->
Jsp×¢ÊÍ: <%-- express --%>
4 JspÓï·¨(Syntax)
¢Ù JSP Element ¡¡¡¡¡¡¡¡
¢Ú Syntax ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
¢Û Interpretation
---------------------------------------------------------------------------------------------
¢Ù JSP Expression
¢Ú <%= expression %>
¢Û Expression is evaluated and placed in output.
---------------------------------------------------------------------------------------------
¢Ù JSP Scriptlet
¢Ú <% code %>
¢Û Code is inserted in service method.
---------------------------------------------------------------------------------------------
¢Ù JSP Declaration
¢Ú <%! code %>
¢Û Code is inserted in body of servlet class, outside of service method.
---------------------------------------------------------------------------------------------
¢Ù JSP page Directive
¢Ú <%@ page att="val" %>
¢Û Directions to the servlet engine about eneral setup.
---------------------------------------------------------------------------------------------
¢Ù JSP include Directive
¢Ú <%@ include file="url" %>
¢Û A file on the local system to be included when the JSP page is translated into a servlet.
---------------------------------------------------------------------------------------------
¢Ù The


Ïà¹ØÎĵµ£º

jsp ÖÐÎÄÂÒÂë½â¾ö´óÈ«

Ò»¡¢JSPÒ³ÃæÏÔʾÂÒÂë
¶þ¡¢±íµ¥Ìá½»ÖÐÎÄʱ³öÏÖÂÒÂë
Èý¡¢Êý¾Ý¿âÁ¬½Ó
´ó¼ÒÔÚJSPµÄ¿ª·¢¹ý³ÌÖУ¬¾­³£³öÏÖÖÐÎÄÂÒÂëµÄÎÊÌ⣬¿ÉÄÜÒ»ÖÁÀ§ÈÅ×ÅÄú£¬ÎÒÏÖÔÚ°ÑÎÒÔÚJSP¿ª·¢ÖÐÓöµ½
µÄÖÐÎÄÂÒÂëµÄÎÊÌâ¼°½â¾ö°ì·¨Ð´³öÀ´¹©´ó¼Ò²Î¿¼¡£
Ò»¡¢JSPÒ³ÃæÏÔʾÂÒÂë
ÏÂÃæµÄÏÔʾҳÃæ(display.jsp)¾Í³öÏÖÂÒÂ룺
<html>
<head>
<tit ......

½â¾öJspÒ³ÃæURLÖд«µÝ²ÎÊýÂÒÂëµÄ·½·¨

JspÒ³ÃæÔÚURLÖд«µÝ²ÎÊý»á³öÏÖÂÒÂë
½â¾ö·½·¨ÈçÏ£º
Ò»¡¢Ê¹Óøü¸ÄTomcatµÄ·½·¨¡£Õâ¸ö·½·¨¼òµ¥£¬µ«ÊÇÐèÒª¸Ä¶¯µÄµØ·½ÊÇ·þÎñÆ÷Èí¼þ¼¶±ðµÄ£¬Èç¹ûÉÔ΢±ä¶¯ÏµÍ³½«ÎÞ·¨ÕýȷתÂ룬ÒÆÖ²ÐÔ²»¸ß¡£
1¡¢À´µ½tomcatĿ¼£¬ÕÒµ½confĿ¼ÏµÄserver.xmlÎʼۣ¬´ò¿ª£¬ÕÒµ½<Connector>±êÇ©£¬ÔÚ×îºóÌí¼ÓURIEncoding=’GBK’£¬Ð ......

jspÎļþÏÂÔØÍêÕû·½·¨

µÚÒ»ÖÖ£º
¾ÍÊÇÖ±½Ó¸ø³öÏÂÔصĵØÖ·£¬ÕâÖÖ·½Ê½ºÜ²»ºÃ£¬ÒòΪ»á±©Â¶ÄãµÄµØÖ·£¬´øÀ´ºÜ¶à²»°²È«µÄÒòËØ£¬¿ÉÒÔ˵ÊÇǧÍò²»ÒªÓÃÕâÖÖ
µÚ¶þÖÖ£º
ÏÂÔØÒ³Ãæ
<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<html>
<head>
<title>download</title>
</head>
< ......

JSP 9´ó¶ÔÏóÏê½â

ѧϰJSPÖ÷ҪѧϰËûµÄ9´ó¶ÔÏó(request, response, pageContext, session, application, out, config, page, exception ),ÕâЩ¶ÔÏó¶¼ÊǾ²Ì¬¶ÔÏ󣬲»Óö¨Òå¾Í¿ÉÒÔÖ±½ÓʹÓ㬰ÑËûÃǶ¼Á˽âÇå³þ²¢»áÔËÓ㬾ͿÉÒÔÔÚ¼òÀúÉÏÌíÉÏÒ»¸öÊìϤ¼¼ÄÜ:JSP
JspÄÚÖöÔÏó ¹¦ÄÜ Ö÷Òª·½·¨
out  Ïò¿Í»§¶ËÊä³öÊý¾Ý print() println() flush() ......

jspÖÐ×Ô¶¨Òå±êÇ©×ܽá(Ò»)_´«Í³±êǩƪ

×Ô¶¨Òå±êÇ©ÊÇÈÿª·¢ÈËÔ±´´½¨¿Í»§»¯µÄ±êÇ©,²¢ÇÒÔÚjspÎļþÖÐʹÓÃÕâЩ±êÇ©,ÕâÑù¿ÉÒÔʹjsp´úÂë¸ü¼ò½à!
 Ê×ÏÈÕâÀïÏȽéÉÜ´Ó¶¨Òå±êÇ©µ½Ê¹ÓñêÇ©µÄ²½Öè:
     1,´´½¨×Ô¶¨Òå±êÇ©´¦ÀíÀà,¼°Ïà¹ØÀà.class ²¢ÇÒ°ÑËûÃǶ¼·ÅÔÚWEB-INF/classesĿ¼ÏÂ
     2,´´½¨TLD±êÇ©¿âÃèÊöÎļþ(.tld)Î ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ