jspѧϰ±Ê¼Ç3
×¢Ò⣺jsp:useBean¶¯×÷£¬ÓÃ±íµ¥ÎªBeanµÄÊôÐÔ¸³ÖµÊ±£¬Ò²¾ÍÊÇjsp:setProperty¶¯×÷Ö±½ÓÊÕÇëÇóÖÐ±íµ¥µÄÐÅϢΪʹÓõÄBeanµÄÊôÐÔ½øÐи³Öµ£¬Ò²¾ÍÊÇ˵jsp:useBeanºÍjsp:setProperty²»Äܹ»³öÏÖÔÚΪÕâ¸öBeanµÄÊôÐÔ¸³ÖµµÄform±íµ¥µÄÒ³ÃæÉÏ¡£
JSPµÄÒì³£´¦Àí
<%@page errorPage="xxx.jsp"%> Ö¸¶¨±¾Ò³Ãæ³öÏÖÒì³£ºóҪתµ½µÄÒ³Ãæ
<%@page iserrorPage="true"%> ¼û±¾Ò³ÃæÖ¸¶¨ÎªÒì³£´¦ÀíÒ³Ã棬Ҳ¾ÍÊÇÆäËû³öÒì³£µÄÒ³Ãæ¿ÉÒÔÖ¸¶¨±¾Ò³ÃæΪҪתµ½µÄÒì³£´¦ÀíÒ³Ãæ¡£
´¦ÀíÒì³£
ÔËÐÐʱÒì³£
1) Ò»¸ö³ÌÐòÔËÐÐʱÖØ»ñµÄ´íÎó;
2) Äܱ»Ò»¹ÌÓеÄÒì³£¶ÔÏóÒýÓÃËùʹÓÃ;
3) ¿ÉÒÔÀûÓÃÒì³£ÒýÓô´½¨»ò²úÉúÒ»¸öJSPÒ³ÃæÏÔʾÒì³£ÐÅÏ¢¸øÓû§¡£
´´½¨Ò»¸öÒì³£¸ú×Ù·½°¸
1) ÔÚÿһ¸öJSPÒ³Ã棬°üº¬Òª´´½¨µÄÒì³£Ò³ÃæÃû³Æ;
<%@page import="numberguess.NumberGuessBean" errorPage="error.jsp"%>
2) ´´½¨Ò»¸öÒì³£Ò³Ãæ;
<%@page isErrorPage="true"%>
JSPÒ³ÃæÖеÄÒì³£´¦Àí
1) <%=exception.toString()%> ´òÓ¡Òì³£Ãû³Æ;
2) <%exception.printStackTrace();%> ´òÓ¡µ±Ç°´íÎóÁ÷ÖÐËùÓдíÎóµÄÁбí;
3) <%=exception.getMessage()%> ´òÓ¡´íÎóµÄÏêϸÃèÊöÐÅÏ¢
JSPÒþº¬ÄÚÖöÔÏó
JSPÖÐÒþº¬ÄÚÖöÔÏó
Ãû³Æ ÀàÐÍ ×¢Êͺͷ¶Î§
request javax.servlet.http.HttpServletRequest request
response javax.servlet.http.HttpServletResponse response
page javax.lang.Object page
Exception java.lang.Throwable page
pageContext javax.servlet.js
Ïà¹ØÎĵµ£º
Èç¹ûÔÚ×Ô¶©±êÇ©¿âʱ£¬²¢²»ÐèÒª¶Ô±êÇ©±¾Ìå×÷´¦Àí£¬ÔòÄú¿ÉÒԼ̳ÐTagSupportÀà±ð£¬TagSupportÀà±ðʵ×÷ÁËTagÓë IterationTag½éÃ棬IterationTag½éÃæÔòÊÇTag½éÃæµÄ×Ó½éÃ棬TagSupportÀà±ðÌæÄúÔ¤ÏÈʵ×÷ÁËÕâÁ½¸ö½éÃæÖеķ½·¨£¬Ôڼ̳ÐTagSupportÖ®ºó£¬ÄúÊÓÐèÒªÀ´¸Äдµ±ÖеÄһЩ·½·¨£¨ÕâÊÇ Default Adapterģʽ£©¡£
Tag½éÃæÖÐÓë±êÇ© ......
1¡¢ÐèҪ׼±¸µÄÈí¼þ£¨Èí¼þû·¨ÉÏ´«Ö»ºÃ·¢µØÖ·£©
£¨1£©jdk1.6
£¨2£©TOMCAT 5.5»òTOMCAT 6.0
2¡¢ÏÈ°²×°jdk1.6£¬Ä¬ÈÏ°²×°¼´¿É£¬°²×°Íêºó£¬µã“¿ªÊ¼” -- “ÔËÐД£¬ÊäÈëcmdÈ·¶¨£¬½øÈëÃüÁî¿ò£¬ÊäÈë“java -version”£¬»Ø³µ£¬¾Í»á³öÀ´javaµÄ ......
Ò»¡¢ÎļþÏÂÔؼ°°æ±¾
apache-tomcat-6.0.20.exe
jdk-6u2-windows-i586-p.exe
¶þ¡¢°²×°¼°»·¾³±äÁ¿ÉèÖÃ
Èí¼þ°²×°ºó£¬ÐèÒªÅäÖû·¾³±äÁ¿¡£Ð½¨JAVA_HOME, CATALINA_HOME, classpath,ÐÞ¸Äpath£º
classpath = ".;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;%CATALINA_HOME%\lib\servlet-api.jar"
path += ";%JAVA_ ......
Ò»£ºweb.xmlÅäÖÃ
<servlet>
<servlet-name>context</servlet-name>
<servlet-class>
org.springframework.web.context.ContextLoaderServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<context-param>
<param-name>cont ......
JSPµÄ×¢ÊÍ
<%--........--%>
JSPÖ¸ÁîºÍJSP¶¯×÷£¨±ê×¼µÄJSP±êÇ©£©
JSPÖ¸ÁîµÄÓï·¨
<%@... ....%>
<%@include file="...."%> °üº¬Ö¸Á°üº¬Ö¸Áî»á½«Òª°üº¬µÄÎļþ´úÂëÔÑùÊä³öµ½±¾Ò³Ã棨ÔÚ·Òëʱ°Ñ°üº¬ÎļþµÄÄÚÈÝÒýÈë²¢ºÏ²¢£©£¬²»½øÐзÒ룬fileÊôÐÔÖƶ¨Òª°üº¬µÄÎļþµÄÃû×Ö£¨×¢ÒâÒª°üº¬µÄÎļþµÄ·¾¶£©£ ......