JavaÏà¶Ô·¾¶/¾ø¶Ô·¾¶×ܽá!
1.»ù±¾¸ÅÄîµÄÀí½â
¾ø¶Ô·¾¶£º¾ø¶Ô·¾¶¾ÍÊÇÄãµÄÖ÷Ò³ÉϵÄÎļþ»òĿ¼ÔÚÓ²ÅÌÉÏÕæÕýµÄ·¾¶£¬(URLºÍÎïÀí·¾¶)ÀýÈ磺
C:xyz est.txt ´ú±íÁËtest.txtÎļþµÄ¾ø¶Ô·¾¶¡£http://www.sun.com/index.htmÒ²´ú±íÁËÒ»¸öURL¾ø¶Ô·¾¶¡£
Ïà¶Ô·¾¶£ºÏà¶ÔÓëij¸ö»ù׼Ŀ¼µÄ·¾¶¡£°üº¬WebµÄÏà¶Ô·¾¶£¨HTMLÖеÄÏà¶ÔĿ¼£©£¬ÀýÈ磺ÔÚ
ServletÖУ¬"/"´ú±íWebÓ¦ÓõĸúĿ¼¡£ºÍÎïÀí·¾¶µÄÏà¶Ô±íʾ¡£ÀýÈ磺"./" ´ú±íµ±Ç°Ä¿Â¼,"../"´ú±íÉϼ¶Ä¿Â¼¡£ÕâÖÖÀàËƵıíʾ£¬Ò²ÊÇÊôÓÚÏà¶Ô·¾¶¡£
ÁíÍâ¹ØÓÚURI£¬URL,URNµÈÄÚÈÝ£¬Çë²Î¿¼RFCÏà¹ØÎĵµ±ê×¼¡£
RFC 2396: Uniform Resource Identifiers (URI): Generic Syntax,
(http://www.ietf.org/rfc/rfc2396.txt)
2.¹ØÓÚJSP/ServletÖеÄÏà¶Ô·¾¶ºÍ¾ø¶Ô·¾¶¡£
2.1·þÎñÆ÷¶ËµÄµØÖ·
·þÎñÆ÷¶ËµÄÏà¶ÔµØÖ·Ö¸µÄÊÇÏà¶ÔÓÚÄãµÄwebÓ¦ÓõĵØÖ·£¬Õâ¸öµØÖ·ÊÇÔÚ·þÎñÆ÷¶Ë½âÎöµÄ£¨²»Í¬ÓÚhtmlºÍjavascriptÖеÄÏà¶ÔµØÖ·£¬ËûÃÇÊÇÓÉ¿Í»§¶Ëä¯ÀÀÆ÷½âÎöµÄ£©Ò²¾ÍÊÇ˵ÕâʱºòÔÚjspºÍservletÖеÄÏà¶ÔµØÖ·Ó¦¸ÃÊÇÏà¶ÔÓÚÄãµÄwebÓ¦Ó㬼´Ïà¶ÔÓÚhttp: //192.168.0.1/webapp/µÄ¡£
ÆäÓõ½µÄµØ·½ÓУº
forward£ºservletÖеÄrequest.getRequestDispatcher(address);Õâ¸öaddressÊÇÔÚ·þÎñÆ÷¶Ë½âÎöµÄ£¬ËùÒÔ£¬ÄãÒªforwardµ½a.jspÓ¦¸ÃÕâôд£ºrequest.getRequestDispatcher(“/user/a.jsp”)Õâ¸ö/ Ïà¶ÔÓÚµ±Ç°µÄwebÓ¦ÓÃwebapp£¬Æä¾ø¶ÔµØÖ·¾ÍÊÇ£ºhttp://192.168.0.1/webapp/user/a.jsp¡£ sendRedirect£ºÔÚjspÖÐ<%response.sendRedirect("/rtccp/user/a.jsp");%>
2.22¡¢¿Í»§¶ËµÄµØÖ·
ËùÓеÄhtmlÒ³ÃæÖеÄÏà¶ÔµØÖ·¶¼ÊÇÏà¶ÔÓÚ·þÎñÆ÷¸ùĿ¼(http://192.168.0.1/)µÄ£¬¶ø²»ÊÇ(¸úĿ¼ÏµĸÃWebÓ¦ÓõÄĿ¼) http://192.168.0.1/webapp/µÄ¡£ HtmlÖеÄform±íµ¥µÄactionÊôÐԵĵØÖ·Ó¦¸ÃÊÇÏà¶ÔÓÚ·þÎñÆ÷¸ùĿ¼(http://192.168.0.1/)µÄ£¬ËùÒÔ£¬Èç¹ûÌá½»µ½a.jsp Ϊ£ºaction£½"/webapp/user/a.jsp"»òaction="<%=request.getContextPath()% >"/user/a.jsp£»
Ìá½»µ½servletΪactiom£½"/webapp/handleservlet" JavascriptÒ²ÊÇÔÚ¿Í»§¶Ë½âÎöµÄ£¬ËùÒÔÆäÏà¶Ô·¾¶ºÍform±íµ¥Ò»Ñù¡£
Òò´Ë£¬Ò»°ãÇé¿öÏ£¬ÔÚJSP/HTMLÒ³ÃæµÈÒýÓõÄCSS,Javascript.ActionµÈÊôÐÔÇ°Ãæ×îºÃ¶¼¼ÓÉÏ
<%=request.getContextPath()%>,ÒÔÈ·±£ËùÒýÓõÄÎļþ¶¼ÊôÓÚWebÓ¦ÓÃÖеÄĿ¼¡£ÁíÍ⣬Ӧ¸Ã¾¡Á¿±ÜÃâʹÓÃÀàËÆ".","./","../../"µÈÀàËƵÄÏà¶Ô¸ÃÎļþλÖõÄÏà¶Ô·¾¶£¬ÕâÑùµ±ÎļþÒƶ¯Ê±£¬ºÜÈÝÒ׳öÎÊÌâ¡£
3. JSP/Ser
Ïà¹ØÎĵµ£º
ÖÚËùÖÜÖª£¬javaµÄÖÐÎÄÎÊÌâÒ»Ö±ÊÇÒ»¸öÀÏ´óÄѵÄÎÊÌ⣬Õâ¸öÏÖÏó¿ÉÒÔÔÚcsdnÖÐjavaÂÛ̳Àï¹ØÓÚÖÐÎÄÂÒÂëµÄÌáÎÊÂʾͿÉÒÔÁ˽⵽£¬ÉõÖÁÈí¼þ¾ÞÈËIBMרÃÅ¿ª±ÙÁËÒ»¸ö½â¾öÖÐÎÄÎÊÌâµÄרÇø£¬×÷Ϊһ¸öË×ÈË£¨Ò»Ö±ÃÎÏëÏ£ÍûÏë½ð¿ÀûÄÇÑù³ÉΪһ¸ö“ðÅÆÌìÉñ”£¬Ö»ÊÇһֱûÓгɹ¦£¬Ò²ÐíÊÇÒòΪÉϵ۲»ÕÕ¹ËÖйú°É£©£¬ÎÒҲΪͬÒâµÄÎÊÌâÀ§ÈÅ£ ......
ÐòÑÔ:
Java ÔÚÔËÐÐÒѱàÒëÍê³ÉµÄÀàʱ£¬ÊÇͨ¹ý java ÐéÄâ»úÀ´×°ÔغÍÖ´Ðеģ¬java ÐéÄâ»úͨ¹ý²Ù×÷
ϵͳÃüÁî JAVA_HOME\bin\java ?option À´Æô¶¯£¬-option ΪÐéÄâ»ú²ÎÊý£¬JAVA_HOME ΪJDK
°²×°Â·¾¶£¬Í¨¹ýÕâЩ²ÎÊý¿É¶ÔÐéÄâ»úµÄÔËÐÐ״̬½øÐе÷Õû£¬ÕÆÎÕ²ÎÊýµÄº¬Òå ......
1.À¬»øÊÕ¼¯Ëã·¨µÄºËÐÄ˼Ïë
¡¡¡¡JavaÓïÑÔ½¨Á¢ÁËÀ¬»øÊÕ¼¯»úÖÆ£¬ÓÃÒÔ¸ú×ÙÕýÔÚʹÓõĶÔÏóºÍ·¢ÏÖ²¢»ØÊÕ²»ÔÙʹÓÃ(ÒýÓÃ)µÄ¶ÔÏ󡣸ûúÖÆ¿ÉÒÔÓÐЧ·À·¶¶¯Ì¬ÄÚ´æ·ÖÅäÖпÉÄÜ·¢ÉúµÄÁ½¸öΣÏÕ£ºÒòÄÚ´æÀ¬»ø¹ý¶à¶øÒý·¢µÄÄÚ´æºÄ¾¡£¬ÒÔ¼°²»Ç¡µ±µÄÄÚ´æÊÍ·ÅËùÔì³ÉµÄÄÚ´æ·Ç·¨ÒýÓá£
¡¡¡¡À¬»øÊÕ¼¯Ëã·¨µÄºËÐÄ˼ÏëÊÇ£º¶ÔÐéÄâ»ú¿ÉÓÃÄÚ´æ¿Õ¼ä£¬¼´¶Ñ¿Õ ......
ÏÂÊöÊ®Ëĸö¼¼ÇÉ£¬ÊÇÐí¶àÈËÔÚ´óÁ¿µÄÊý¾Ý¿â·ÖÎöÓëÉè¼Æʵ¼ùÖУ¬Öð²½×ܽá³öÀ´µÄ¡£¶ÔÓÚÕâЩ¾ÑéµÄÔËÓ㬶ÁÕß²»ÄÜÉú°ïÓ²Ì×£¬ËÀ¼ÇÓ²±³£¬¶øÒªÏû»¯Àí½â£¬ÊµÊÂÇóÊÇ£¬Áé»îÕÆÎÕ¡£²¢Öð²½×öµ½£ºÔÚÓ¦ÓÃÖз¢Õ¹£¬ÔÚ·¢Õ¹ÖÐÓ¦Óá£
1. Ôʼµ¥¾ÝÓëʵÌåÖ®¼äµÄ¹Øϵ
¿ÉÒÔÊÇÒ»¶ÔÒ»¡¢Ò»¶Ô¶à¡¢¶à¶Ô¶àµ ......
ÕâÊÇһЩÏ൱²»´íµÄÖҸ棡ÿ¸ö¹æÔò¶¼ºÜÓзÖÁ¿£¡¶¼Êdz¤ÆÚ¾Ñé»ýÀÛµÄ×ܽᣬϣÍûÄܶÔÄúÓÐËù°ïÖú£¬Ê¹Äú±à³ö¸ßÖÊÁ¿µÄJAVA´úÂë¡£ÖÐÎÄJAVA¼¼ÊõÍøfX
W,c6I/R!_3Bb
ÖÐÎÄJAVA¼¼ÊõÍø6o9yV+M
u+V2Nfr5vm
(1)ÀàÃûÊ××ÖĸӦ¸Ã´óд¡£×ֶΡ¢·½·¨ÒÔ¼°¶ÔÏ󣨾ä±ú£©µÄÊ××ÖĸӦСд¡£¶ÔÓÚËùÓбêʶ·û£¬ÆäÖаüº¬µÄËù
Óе¥´Ê¶¼Ó¦½ô¿¿ ......