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

java jsp servletÖеľø¶Ô·¾¶ÓëÏà¶Ô·¾¶(תÔØ)

 
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Ó¦ÓÃÖеÄĿ¼¡£ÁíÍ⣬Ӧ¸Ã¾¡Á¿±ÜÃâʹÓÃÀàËÆ".&


Ïà¹ØÎĵµ£º

javaÈëÃÅ

 Javaѧϰ´ÓÈëÃŵ½¾«Í¨ 
Ò»¡¢ JDK (Java Development Kit) 
JDKÊÇÕû¸öJavaµÄºËÐÄ£¬°üÀ¨ÁËJavaÔËÐл·¾³£¨Java Runtime Envirnment£©£¬Ò»¶ÑJava¹¤¾ßºÍJava»ù´¡µÄÀà¿â(rt.jar)¡£²»ÂÛʲôJavaÓ¦Ó÷þÎñÆ÷ʵÖʶ¼ÊÇÄÚÖÃÁËij¸ö°æ±¾µÄJDK¡£Òò´ËÕÆÎÕJDKÊÇѧºÃJavaµÄµÚÒ»²½¡£×îÖ÷Á÷µÄJ ......

Java¶Áдcookie

Java¶Áдcookie
/*
 * дcookie
*/
Cookie namecookie = new Cookie("name",name);
Cookie passwordcookie = new Cookie("password",password);
Cookie optioncookie = new Cookie("option","1");
//ÉúÃüÖÜÆÚ    
namecookie.setMaxAge(60*60*24*365);
passwordcookie.setMaxAge(60*60* ......

JavaÖеÄÄÚ²¿Àà³õѧ

1.¶¨Ò壺 ¹ËÃû˼Òå¾ÍÊÇÔÚÀàÖж¨ÒåµÄÀ࣬·ÖΪÁ½À࣬static µÄ ºÍ non-static µÄ¡£ÄÚ²¿Ààʵ¼ÊÉÏÊÇÒ»¸ö±àÒëÆ÷µÄÏÖÏó¡£±àÒëÆ÷½«ÄÚ²¿Ààת»¯Îª´ø×ÅһЩÆæ¹ÖÃû×ÖµÄÆÕͨÀàÎļþ£¬ÐéÄâ»ú²¢²»Çø·ÖÒ»°ãÀàºÍÄÚ²¿ÀàµÄÀàÖеÄÎļþ¡£ 2.ʹÓÃÄÚ²¿ÀàµÄµÚÒ»¸öºÃ´¦——·â×°ÐԺͶà¼Ì³Ð ÎÒÃǽøÐС°µÚÈýÖÖ¹Øϵ¡±·ÖÎö£º ¼Ì³Ð½á¹¹ÖÐÎ ......

Java¼àÌýÆ÷ѧϰ ͳ¼Æµ±Ç°ÔÚÏßÈËÊý

 javax.servlet.http.HttpSession Õâ¸öÀàÊǺܳ£Óõģ¬Ã¿µ±ÎÒÃÇä¯ÀÀÍøÕ¾£¬²»ÂÛÓÐûÓеǽ£¬¶¼»á²úÉú1¸ösession£¬Ëü¼Ç¼Á˺Íä¯ÀÀÕßÏà¹ØµÄÊý¾Ý£»
ÏÂÃæ½éÉÜsessionµÄ2¸ö¼àÌýÆ÷½Ó¿Ú£º
1£©javax.servlet.http.HttpSessionBindingListener;
ʵÏÖÕâ¸ö½Ó¿ÚµÄÀ࣬ÿµ±±»´æ·Åµ½session»ò´ÓsessionÖÐÒƳý¶¼»á³ö·¢½Ó¿ÚÖÐÏàÓ¦µ ......

java¶ÑÕ»

       1. Õ»(stack)Óë¶Ñ(heap)¶¼ÊÇJavaÓÃÀ´ÔÚRamÖдæ·ÅÊý¾ÝµÄµØ·½¡£ÓëC++²»Í¬£¬Java×Ô¶¯¹ÜÀíÕ»ºÍ¶Ñ£¬³ÌÐòÔ±²»ÄÜÖ±½ÓµØÉèÖÃÕ»»ò¶Ñ¡£
¡¡¡¡2. Õ»µÄÓÅÊÆÊÇ£¬´æÈ¡ËٶȱȶÑÒª¿ì£¬½ö´ÎÓÚÖ±½ÓλÓÚCPUÖеļĴæÆ÷¡£µ«È±µãÊÇ£¬´æÔÚÕ»ÖеÄÊý¾Ý´óСÓëÉú´æÆÚ±ØÐëÊÇÈ·¶¨µÄ£¬È±·¦Áé»îÐÔ¡£ÁíÍ⣬ջÊý¾Ý¿ÉÒÔ¹ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ