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

JSP¾Å´óÄÚÖöÔÏó¼°Ëĸö×÷ÓÃÓò

¾Å´ó¶ÔÏó£º
ÄÚÖöÔÏó£¨ÓÖ½ÐÒþº¬¶ÔÏó£¬ÓÐ9¸öÄÚÖöÔÏó£©:²»ÐèÒªÔ¤ÏÈÉùÃ÷¾Í¿ÉÒÔÔڽű¾´úÂëºÍ±í´ïʽÖÐËæÒâʹÓÃ
1-out:
 javax.servlet.jsp.JspWriterÀàÐÍ£¬´ú±íÊä³öÁ÷µÄ¶ÔÏó¡£×÷ÓÃÓòΪpage£¨Ò³ÃæÖ´ÐÐÆÚ£©
request£ºjavax.servlet.ServletRequestµÄ×ÓÀàÐÍ£¬´Ë¶ÔÏó·â×°ÁËÓÉWEBä¯ÀÀÆ÷»òÆäËü¿Í»§¶ËÉú³ÉµØHTTP
ÇëÇóµÄϸ½Ú£¨²ÎÊý£¬ÊôÐÔ£¬Í·±êºÍÊý¾Ý£©¡£×÷ÓÃÓòΪrequest(Óû§ÇëÇóÆÚ£©¡£
·½·¨Óɿɲ鿴API
response£ºjavax.servlet.ServletResponseµÄ×ÓÀàÐÍ£¬´Ë¶ÔÏó·â×°ÁË·µ»Øµ½HTTP¿Í»§¶ËµÄÊä³ö£¬ÏòÒ³Ãæ
×÷ÕßÌṩÉèÖÃÏìӦͷ±êºÍ״̬ÂëµÄ·½Ê½¡£¾­³£ÓÃÀ´ÉèÖÃHTTP±êÌ⣬Ìí¼Ócookie£¬ÉèÖÃÏìÓ¦ÄÚÈݵÄÀàÐͺÍ×´
̬£¬·¢ËÍHTTPÖض¨ÏòºÍ±àÂëURL¡£×÷ÓÃÓòΪpage£¨Ò³ÃæÖ´ÐÐÆÚ£©¡£
pageContext£ºjavax.servlet.jsp.PageContext£¨³éÏóÀࣩÀàÐÍ£¬×÷ÓÃÓòΪpage£¨Ò³ÃæÖ´ÐÐÆÚ£©¡£´Ë¶ÔÏó
ÌṩËùÓÐËĸö×÷ÓÃÓò²ã´ÎµÄÊôÐÔ²éѯºÍÐÞ¸ÄÄÜÁ¦£¬ËüÒ²ÌṩÁËת·¢ÇëÇóµ½ÆäËü×ÊÔ´ºÍ°üº¬ÆäËû×ÊÔ´µÄ·½·¨
£º
¸Ã¶ÔÏóµÄ·½·¨¶¼ÊdzéÏó·½·¨
session£ºjavax.servlet.http.HttpSessionÀàÐÍ£¬Ö÷ÒªÓÃÓÚ¸ú×Ù¶Ô»°¡£×÷ÓÃÓòsession(»á»°ÆÚ—£©¡£
HttpSessionÊÇÒ»¸öÀàËƹþÏ£±íµÄÓëµ¥Ò»WEBä¯ÀÀÆ÷»á»°Ïà¹ØµÄ¶ÔÏó£¬Ëü´æÔÚÓÚHTTPÇëÇóÖ®¼ä£¬¿ÉÒÔ´æ´¢ÈÎ
ºÎÀàÐ͵ÄÃüÃû¶ÔÏó¡£
Èç¹û²»ÐèÒªÔÚÇëÇóÖ®¼ä¸ú×ٻỰ¶ÔÏ󣬿ÉÒÔͨ¹ýÔÚpageÖ¸ÁîÖÐÖ¸¶¨session="false"
ÐèÒª¼ÇסµÄÊÇpageContext¶ÔÏóÒ²¿ÉÒÔÓësession.getAttribute(),session.setAttribute()Ò»ÑùµÄ·½Ê½È¡
µÃ²¢ÉèÖûỰÊôÐÔ¡£
application£ºjavax.servlet.ServletContextÀàÐÍ£¬servletµÄ»·¾³Í¨¹ýµ÷ÓÃgetServletConfig
().getContext()·½·¨»ñµÃ¡£×÷ÓÃÓòÊÇapplication(Õû¸ö³ÌÐòÔËÐÐÆÚ£©¡£ËüÌṩÁ˹ØÓÚ·þÎñÆ÷°æ±¾£¬Ó¦ÓÃ
¼¶³õʼ»¯²ÎÊýºÍÓ¦ÓÃÄÚ×ÊÔ´¾ø¶Ô·¾¶£¬×¢²áÐÅÏ¢µÄ·½Ê½
config£ºjavax.servlet.ServletConfig,×÷ÓÃÓòΪpage£¨Ò³ÃæÖ´ÐÐÆÚ£©
exception:java.lang.Throwable,ͨ¹ýJSP´íÎóÒ³ÃæÖÐÒ»¸öcatch¿éÒѾ­Òæ³öµ«Ã»ÓⶻñµÄ
java.lang.ThrowableµÄÈÎÒâʵÀý£¬´«ÏòÁËerrorPageµÄURI¡£×÷ÓÃÓòΪpage£¨Ò³ÃæÖ´ÐÐÆÚ£©¡£×¢Òâ
exceptionÖ»ÓÐÔÚpageÖ¸ÁîÖоßÓÐÊôÐÔisErrorPage="true"ʱ²ÅÓÐЧ¡£
page:java.lang.ObjectÀàÐÍ£¬Ö¸ÏòÒ³Ãæ×ÔÉíµÄ·½Ê½¡£×÷ÓÃÓòΪpage£¨Ò³ÃæÖ´ÐÐÆÚ
JSPÖоŴóÄÚÖöÔÏóΪ£º
request            ÇëÇó¶ÔÏó¡¡         &n


Ïà¹ØÎĵµ£º

JSPÖÐʹÓÃIncludeÓëJSP£ºIncludeµÄÇø±ð

ÎÒÃǶ¼ÖªµÀÔÚjspÖÐincludeÓÐÁ½ÖÖÐÎʽ,·Ö±ðÊÇ
< %@ include file=” ”% >
< jsp:include page=” ” flush=”true”/ >
Ç°ÕßÊÇÖ¸ÁîÔªËØ¡¢ºóÕßÊÇÐÐΪԪËØ¡£
¾ßÌåËüÃǽ«Ôںδ¦Óã¿ÈçºÎÓü°ËüÃÇÓÐʲôÇø±ð£¿ÕâÓ¦¸ÃÊǺܶàÈË¿´µ½Ëü¶¼»áÏëµ½µÄÎÊÌâ¡£ÏÂÃæÒ»ÆðÀ´¿´¿´°É¡£
ͨ³£ ......

JSP»ù´¡ÖªÊ¶


JSPԭʼ´úÂëÖаüº¬ÁËJSPÔªËغÍTemplate(Ä£°å) dataÁ½Àà 
Template dataÖ¸µÄÊÇJSPÒýÇæ²»´¦ÀíµÄ²¿·Ö£¬¼´±ê¼Ç<%……%>ÒÔÍâµÄ²¿·Ö£¬
ÀýÈç´úÂëÖеÄHTMLµÄÄÚÈÝµÈ £¬ÕâЩÊý¾Ý»áÖ±½Ó´«Ë͵½¿Í»§¶ËµÄä¯ÀÀÆ÷
JSPÔªËØÔòÊÇÖ¸½«ÓÉJSPÒýÇæÖ±½Ó´¦ÀíµÄ²¿·Ö£¬ÕâÒ»²¿·Ö±ØÐë·ûºÏJSPÓï·¨£¬
·ñÔò»áµ¼Ö±àÒë´íÎó¡£
¶ ......

JUnitѧϰ±Ê¼Ç14 ¶ÔJSPºÍtaglib½øÐе¥Ôª²âÊÔ1

                                                  A tes ......

JUnitѧϰ±Ê¼Ç16 ÓÃJSPºÍtaglib½øÐе¥Ôª²âÊÔ3

ÓÃmock objects¶Ôtaglib½øÐе¥Ôª²âÊÔ    ÒòΪJSP²»ÊÇ´¿´âµÄjava´úÂ룬ËùÒÔ£¬Ê¹ÓÃmock½øÐвâÊÔÊÇÐв»Í¨µÄ£¬µ«ÊÇ£¬taglibÈ´ÊÇ´¿´âµÄjava´úÂ룬¿ÉÒÔ²âÊÔ£¬µ«ÊÇËüÒ²ÓÐÂé·³µÄµØ·½£¬ÎÒÃÇҪΪ³éÏóµÄjavaÀàµÄPageContext´´½¨mocks¡£    ÔÚÇ°Ã棬ÎÒÃÇÔøѧϰÁËʹÓÃEasyMockºÍDynaMockµÄ¿ò¼ÜÀ´´´½¨mock£¬µ«ÊÇ£¬ ......

Java Web µÚ9Ìì jsp 2

5.      

JSP
±ê×¼¶¯×÷¡¢
JSP
Ö¸ÁîÓÃÓÚÒ³ÃæÓëÈÝÆ÷¼äµÄͨÐÅ£¬¶ø
JSP
±ê×¼¶¯×÷ÓÃÓÚÒ³ÃæÓëÒ³Ãæ»òÕßÒ³ÃæÓë×é¼þ¼äµÄͨÐÅ¡£È磺
<jsp:include
page=”localURL” flush=”true”>
 
6.      

JSP
Òþʽ¶ÔÏó
ÔÚ
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ