ÈçºÎtomcatÏÂÅäÖÃjsp¡¢servletºÍben
¾³£¿´µ½jspµÄ³õѧÕßÎÊtomcatÏÂÈçºÎÅäÖÃjsp¡¢servletºÍbeanµÄÎÊÌ⣬ÓÚÊÇ×ܽáÁËÒ»ÏÂÈçºÎtomcatÏÂÅäÖÃjsp¡¢servletºÍben£¬Ï£Íû¶ÔÄÇЩ³õѧÕßÓÐËù°ïÖú¡£ µÚÒ»²½£ºÏÂÔØj2sdkºÍtomcat£ºµ½sun¹Ù·½Õ¾µã£¨http: //java.sun.com/j2se/1.4.2/download.html£©ÏÂÔØj2sdk£¬×¢ÒâÏÂÔذ汾Ϊ Windows Offline InstallationµÄSDK£¬Í¬Ê±×îºÃÏÂÔØJ2SE 1.4.2 Documentation£¬È»ºóµ½ tomcat¹Ù·½Õ¾µã£¨http://www.apache.org/dist/jakarta/tomcat-4/£©ÏÂÔØtomcat£¨ÏÂÔØ×îР4.1.x°æ±¾µÄtomcat£©£» µÚ¶þ²½£º°²×°ºÍÅäÖÃÄãµÄj2sdkºÍtomcat£ºÖ´ÐÐj2sdkºÍtomcatµÄ°²×°³ÌÐò£¬È»ºó°´Ä¬ÈÏÉèÖýøÐа²×°¼´¿É¡£ 1.°²×°j2sdkÒÔºó£¬ÐèÒªÅäÖÃһϻ·¾³±äÁ¿£¬ÔÚÎҵĵçÄÔ->;ÊôÐÔ->;¸ß¼¶->;»·¾³±äÁ¿->;ϵͳ±äÁ¿ÖÐÌí¼ÓÒÔÏ»·¾³±äÁ¿(¼Ù¶¨ÄãµÄj2sdk°²×°ÔÚc:\j2sdk1.4.2£©£º JAVA_HOME=c:\j2sdk1.4.2 classpath=.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;£¨.;Ò»¶¨²»ÄÜÉÙ£¬ÒòΪËü´ú±íµ±Ç°Â·¾¶) path=%JAVA_HOME%\bin ½Ó×Å¿ÉÒÔдһ¸ö¼òµ¥µÄjava³ÌÐòÀ´²âÊÔJ2SDKÊÇ·ñÒÑ°²×°³É¹¦£º public class Test{ public static void main(String args[]){ System.out.println("This is a test program."); } } ½«ÉÏÃæµÄÕâ¶Î³ÌÐò±£´æΪÎļþÃûΪTest.javaµÄÎļþ¡£ È»ºó´ò¿ªÃüÁîÌáʾ·û´°¿Ú£¬cdµ½ÄãµÄTest.javaËùÔÚĿ¼£¬È»ºó¼üÈëÏÂÃæµÄÃüÁî javac Test.java java Test ´ËʱÈç¹û¿´µ½´òÓ¡³öÀ´This is a test program.µÄ»°ËµÃ÷°²×°³É¹¦ÁË£¬Èç¹ûûÓдòÓ¡³öÕâ¾ä»°£¬ÄãÐèÒª×Ðϸ¼ì²éÒ»ÏÂÄãµÄÅäÖÃÇé¿ö¡£ 2.°²×°Tomcatºó£¬ÔÚÎҵĵçÄÔ->;ÊôÐÔ->;¸ß¼¶->;»·¾³±äÁ¿->;ϵͳ±äÁ¿ÖÐÌí¼ÓÒÔÏ»·¾³±äÁ¿(¼Ù¶¨ÄãµÄtomcat°²×°ÔÚc:\tomcat£©£º CATALINA_HOME=c:\tomcat; CATALINA_BASE=c:\tomcat; È»ºóÐ޸Ļ·¾³±äÁ¿ÖеÄclasspath£¬°Ñtomat°²×°Ä¿Â¼ÏµÄcommon\libϵÄservlet.jar×·¼Óµ½classpathÖÐÈ¥£¬Ð޸ĺóµÄclasspathÈçÏ£º classpath=.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;%CATALINA_HOME%\common\lib\servlet.jar; ½Ó×Å¿ÉÒÔÆô¶¯tomcat£¬ÔÚIEÖзÃÎÊhttp://localhost:8080£¬Èç¹û¿´µ½tomcatµÄ»¶ÓÒ³ÃæµÄ»°ËµÃ÷°²×°³É¹¦ÁË¡£ µÚÈý²½£º½¨Á¢×Ô¼ºµÄjsp appĿ¼ 1.µ½TomcatµÄ°²×°Ä¿Â¼µÄwebappsĿ¼£¬¿ÉÒÔ¿´µ½ROOT£¬examples, tomcat-docsÖ®ÀàTomcat×Ô´øµÄµÄĿ¼£» 2.ÔÚwebappsĿ¼ÏÂн¨Ò»¸öĿ¼£¬ÆðÃû½Ðmyapp£» 3.myappÏÂн¨Ò»¸öĿ¼WEB-INF£¬×¢Ò⣬Ŀ¼Ãû³ÆÊÇÇø·Ö´óСдµÄ£» 4.WEB-INFÏÂн¨Ò
Ïà¹ØÎĵµ£º
ºÜ¶àÀýÈçµÇ¼»òÕß×¢ÏúµÇ¼µÄµØ·½ÐèҪʹÓõ½Cookie£¬½ñÌìѧµ½ÔÚJSPÖÐÈçºÎ²Ù×÷Cookie·ÖÏíÏÂ
4.CookieÀà³£Óõķ½·¨
1.setValue()/getValue() —>»ñÈ¡cookie¶ÔÏóµÄÖµ¡£
2.getName()—>»ñÈ¡cookie¶ÔÏóµÄÃû³Æ£¬Ñ»·µÄʱºò¿ÉÒÔÓÐÑ¡ÔñµÄʹÓÃCookie
3.setMaxAge()/getMaxAge()—>ÉèÖûò»ñÈ¡cookie¶ÔÏóÓÐ ......
JSP×Ô¶¨Òå±êǩѧϰ(¸ß¼¶)
¹Ø¼ü×Ö: ×Ô¶¨Òå±êÇ©
BodyTag½Ó¿Ú
½Ó¿ÚBodyTagµÄʵÏÖÀà,ËüÊǸºÔð²Ù×÷Ö÷ÌåÄÚÈÝ(bodyContent).
¶¨Òå·½·¨:public void doInitBody();
public int doAtferBody();
Ìáʾ,ÄÇЩÔÚdoStartTag()·½·¨Ö®ºó±»µ÷Óõķ½·¨ÒÀÀµÓÚdoStartTag()·½·¨·µ»ØÖµ²¢ÇÒ¿´ÔÚJSPÒ³ ......
¿ª·¢ÖУ¬³£³£ÐèÒª¶ÔÖ¸¶¨µÄÇëÇó¸ñʽ½øÐйýÂË¡£
±ÈÈ磬Struts2µÄÓ¦ÓÃÖУ¬ÍùÍùÒª¹ýÂ˵ô *.jspµÄÇëÇó
¡ùhttp://127.0.0.1:8080/Sample/login.actionÕâÑùµÄÇëÇó±»ÔÊÐí¡£
¡ùhttp://127.0.0.1:8080/Sample/login.£ê£ó£ðÕâÑùµÄÇëÇóÓ¦¸Ã±»¹ýÂË£¬²¢Ö¸¶¨Ìøתµ½Ä³¸öÒ³Ãæ»òÖ´ÐÐij¸öActionµÈµÈ
Struts2ÖеĹýÂËÆ÷¸ºÔð¹ýÂËËù ......
ÔÚconf/web.xmlÖÐÃûΪjspµÄservletÖпÉÒÔ¼ÓÈëһЩinit²ÎÊý
· checkInterval - Èç¹û“development”ÊôÐÔΪfalseÇÒ“checkInterval”´óÓÚ0£¬ÔòʹÓúǫ́±àÒë¡£“checkInterval”ÊDz鿴JSPÒ³Ãæ(°üÀ¨Æ丽ÊôÎļþ)ÊÇ·ñÐèÒªÖØбàÒëµÄÁ½´Î¼ì²éʱ¼ä¼ä¸ô£¨µ¥Î»£ºÃ룩¡£È±Ê¡ÖµÎª0Ãë¡£
&m ......
1.н¨Ò»¸öexcelÎļþ Ãû×ÖËæ±ã À©Õ¹Ãû .xls
2.µÚÒ»ÐÐÊDZíÍ· дÉÏÁÐÃû Èç id pwd
ÏÂÃæ¾ÍÊÇдÊý¾ÝµÄµØ·½
Ñ¡ÖÐÒ»¶ÎÇøÓò Èçͼ
²Ëµ¥ ²åÈë--Ãû³Æ--¶¨Òå
È¡¸öÃû×Ö µãÌí¼Ó Õâ¸öÃû×Ö¾ÍÊDZíÃû
3.ÉèÖÃÊý¾ÝÔ´
ϵͳDSN--Ìí¼Ó-- ......