windows2003ÏÂÅäÖÃJSPÔËÐл·¾³
Ê×ÏÈ£¬±ØÐë˵Ã÷ÕâЩ²»ÊÇÎÒ×Ô¼ºÐ´µÄ£¬µ«ÊǸøÁËÎҺܴó°ïÖú£¬Ï£Íû¶ÔÄãÒ²ÄÜÓÐËù°ïÖú£¡
×£Äã³É¹¦£¡
Ò»¡¢¿ª·¢»·¾³ÅäÖÃ
µÚÒ»²½£ºÏÂÔØj2sdkºÍtomcat£ºµ½sun¹Ù·½Õ¾£¨http://java.sun.com/j2se/1.5.0/download.jsp£©ÏÂÔØj2sdk£¬×¢ÒâÏÂÔذ汾ΪWindows Offline InstallationµÄSDK£¬Í¬Ê±×îºÃÏÂÔØJ2SE 1.5.0 Documentation£¬È»ºóµ½tomcat¹Ù·½Õ¾µã£¨http://jakarta.apache.org/site/downloads/downloads_tomcat-5.cgi£©ÏÂÔØtomcat£¨ÏÂÔØ×îÐÂ5.5.9°æ±¾µÄtomcat£©£»
µÚ¶þ²½£º°²×°ºÍÅäÖÃÄãµÄj2sdkºÍtomcat£ºÖ´ÐÐj2sdkºÍtomcatµÄ°²×°³ÌÐò£¬È»ºó°´Ä¬ÈÏÉèÖýøÐа²×°¼´¿É¡£
1.°²×°j2sdkÒÔºó£¬ÐèÒªÅäÖÃһϻ·¾³±äÁ¿£¬ÔÚÎҵĵçÄÔ->ÊôÐÔ->¸ß¼¶->»·¾³±äÁ¿->ϵͳ±äÁ¿ÖÐÌí¼ÓÒÔÏ»·¾³±äÁ¿(¼Ù¶¨ÄãµÄj2sdk°²×°ÔÚc:\j2sdk1.5.0£©£º
JAVA_HOME=c:\j2sdk1.5.0
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£¬×¢Òâ
Ïà¹ØÎĵµ£º
±¾ÎÄÊÇÐ嵀 JSP ×î¼Ñʵ¼ùϵÁÐÎÄÕµĵÚÒ»²¿·Ö£¬Ëü½éÉÜÁË JavaServer Pages include »úÖÆ¡£Çë¸úËæ Java ±à³Ìר¼Ò Brett McLaughlin ѧϰÈçºÎʹÓà include ½«¾²Ì¬µÄÍ·ÎļþºÍ½Å×¢Îļþ¼ÓÈëÄúµÄÍøÕ¾»ò Web Ó¦ÓóÌÐòÒ³ÃæÖС£
»¶ÓÔĶÁ Java רÇøÖÐ×îеÄ×î¼Ñʵ¼ùϵÁÐÎÄÕ¡£Èç¹ûÄú¿´¹ýÏÈÇ°µÄϵÁÐÎÄÕ£¬ÄÇôÄú»áÖªµÀ×î¼Ñʵ¼ùÖ¼ÔÚÈà ......
JSP+JavaScrip
t´òÔì¶þ¼¶¼¶ÁªÏÂÀ²Ëµ¥£º
(¸öÈ˲©¿Í£ºwww.duduct.com)
class(Ò»¼¶À¸Ä¿ÐÅÏ¢£©£ºclassId(×Ô¶¯±àºÅ£©£¬className£¨À¸Ä¿Ãû³Æ£©,
Nclass£¨¶þ¼¶À¸Ä¿ÐÅÏ¢£©,
NclassId£¨×Ô¶¯±àºÅ£©£¬NclassName(À¸Ä¿Ãû³Æ£©£¬parentId£¨Ò»¼¶À¸Ä¿id£¬Óëclass±íÖеÄclassId¹ØÁª£©
......
ÔÚWEBÓ¦ÓÃÖÐ,Èç¹ûʹÓÃjsp×÷Ϊview²ãµÄÏÔʾģ°å,¶¼»á±»¿Õ¸ñ/¿Õ»»ÐÐÎÊÌâËùÀ§ÈÅ.
Õâ¸öÎÊÌâµ±ÄêÒ²À§ÈÅÁËÎұȽϳ¤µÄʱ¼ä.ÒòΪÔÚjspÄÚʹÓõÄEL±êÇ©ºÍÆäËû±êǩʱ,»á²úÉú´óÁ¿µÄ¿Õ¸ñºÍ»»Ðзû.ÀýÈç:
------- start ----------
<c:choose>
<c:when test="${fn:length(mainPageList)>1&}&q ......
1. RequestDispatcher.forward()
ÊÇÔÚ·þÎñÆ÷¶ËÆð×÷ÓÃ,µ±Ê¹ÓÃforward()ʱ,Servlet engine´«µÝHTTPÇëÇó´Óµ±Ç°µÄServlet or JSPµ½ÁíÍâÒ»¸öServlet,JSP »òÆÕͨHTMLÎļþ,Ò²¼´ÄãµÄformÌá½»ÖÁa.jsp,ÔÚa.jspÓõ½ÁËforward()Öض¨ÏòÖÁb.jsp,´ËʱformÌá½»µÄËùÓÐÐÅÏ¢ÔÚ b.jsp¶¼¿ÉÒÔ»ñµÃ,²ÎÊý×Ô¶¯´«µÝ. µ«forward()ÎÞ·¨Öض¨ÏòÖÁÓÐframeµ ......
3. £¼jsp:forward page="" /£¾
ËüµÄµ×²ã²¿·ÖÊÇÓÉRequestDispatcherÀ´ÊµÏֵģ¬Òò´ËËü´øÓÐRequestDispatcher.forward()·½·¨µÄÓ¡¼Ç¡£
Èç¹ûÔÚ֮ǰÓкܶàÊä³ö,Ç°ÃæµÄÊä³öÒÑʹ»º³åÇøÂú,½«×Ô¶¯Êä³öµ½¿Í»§¶Ë,ÄÇô¸ÃÓï¾ä½«²»Æð×÷ÓÃ,ÕâÒ»µãÓ¦¸ÃÌرð×¢Òâ¡£
ÁíÍâҪעÒ⣺Ëü²»Äܸıää¯ÀÀÆ÷µØÖ·£¬Ë¢ÐµĻ°»áµ¼ÖÂÖظ´Ìá½»
4. ÐÞ¸ÄHTTP ......