JSPÖеÄCOOKIE²Ù×÷
JSPÖеÄCOOKIE²Ù×÷
Cookie¸ÅÄî:
CookieµÄ¸ñʽʵ¼ÊÉÏÊÇÒ»¶Î´¿Îı¾ÐÅÏ¢, ÓÉ·þÎñÆ÷Ëæ×ÅÍøÒ³Ò»Æð·¢Ë͵½¿Í»§¶Ë, ²¢±£´æÔÚ¿Í»§¶ËÓ²ÅÌÖÐÖ¸¶¨µÄĿ¼µÄ. ´ó¼Ò¶¼´«ËµCookie»áÔì³ÉÑÏÖصݲȫÍþвʲôµÄ, Æäʵ²»ÊÇÕâô»ØÊÂÇé. ·þÎñÆ÷¶ÁÈ¡CookieµÄʱºò, Ö»Äܹ»¶ÁÈ¡µ½Õâ¸ö·þÎñÆ÷Ïà¹ØµÄÐÅÏ¢. ¶øÇÒ, ä¯ÀÀÆ÷Ò»°ãÖ»ÔÊÐí´æ·Å300¸öCookie, ÿ¸öÕ¾µã×î¶à´æ·Å20¸ö, ¶øÇÒ, ÿ¸öCookieµÄ´óСÏÖÔÚÔÚ4K, ¸ù±¾²»»áÕ¼ÓöàÉÙ¿Õ¼ä. ²¢ÇÒ, CookieÊÇÓÐʱЧÐÔÖʵÄ. ÀýÈç, ÉèÖÃÁËCookieµÄ´æ»îʱ¼äΪ1·ÖÖÓ, ÔòÒ»·ÖÖÓºóÕâ¸öCookie¾Í»á±»ä¯ÀÀÆ÷ɾ³ý
Cookie°æ±¾:
Ä¿Ç°ÓÐÁ½¸ö°æ±¾:
°æ±¾0 : ÓÉNetscape¹«Ë¾Öƶ¨µÄ£¬Ò²±»¼¸ºõËùÓеÄä¯ÀÀÆ÷Ö§³Ö. JavaÖÐΪÁ˱£³Ö¼æÈÝÐÔ, Ä¿Ç°Ö»Ö§³Öµ½°æ±¾0, CookieµÄÄÚÈÝÖв»ÄÜ¿Õ¸ñ£¬·½À¨ºÅ£¬Ô²À¨ºÅ£¬µÈÓںţ¨=£©£¬¶ººÅ£¬Ë«ÒýºÅ£¬Ð±¸Ü£¬Îʺţ¬@·ûºÅ£¬Ã°ºÅ£¬·ÖºÅ¡£
°æ±¾1 : ¸ù¾ÝRFC 2109ÎĵµÖƶ¨µÄ. ·Å¿íÁ˺ܶàÏÞÖÆ. ÉÏÃæËùÏÞÖƵÄ×Ö·û¶¼¿ÉÒÔʹÓÃ. µ«ÎªÁ˱£³Ö¼æÈÝÐÔ, Ó¦¸Ã¾¡Á¿±ÜÃâʹÓÃÕâЩÌØÊâ×Ö·û.
JSPÖжÔCookieµÄ²Ù×÷: ÀàÐÍ ·½·¨Ãû ·½·¨½âÊÍ
String getComment() ·µ»ØcookieÖÐ×¢ÊÍ,Èç¹ûûÓÐ×¢Ê͵Ļ°½«·µ»Ø¿ÕÖµ.
String getDomain() ·µ»ØcookieÖÐCookieÊÊÓõÄÓòÃû. ʹÓÃgetDomain() ·½·¨¿ÉÒÔָʾä¯ÀÀÆ÷°ÑCookie·µ»Ø¸øͬ Ò»ÓòÄÚµÄÆäËû·þÎñÆ÷,¶øͨ³£CookieÖ»·µ»Ø¸øÓë·¢ËÍËüµÄ·þÎñÆ÷Ãû×ÖÍêÈ«ÏàͬµÄ·þÎñÆ÷¡£×¢ÒâÓòÃû±ØÐëÒԵ㿪ʼ
int getMaxAge() ·µ»ØCookie¹ýÆÚ֮ǰµÄ×î´óʱ¼ä£¬ÒÔÃë¼ÆËã¡£
String getName() ·µ»ØCookieµÄÃû×Ö
String getPath() ·µ»ØCookieÊÊÓõÄ·¾¶¡£Èç¹û²»Ö¸¶¨Â·¾¶£¬Cookie½«·µ»Ø¸øµ±Ç°Ò³ÃæËùÔÚĿ¼¼°Æä×ÓĿ¼Ï µÄËùÓÐÒ³Ãæ¡£
boolean getSecure() Èç¹ûä¯ÀÀÆ÷ͨ¹ý°²È«ÐÒé·¢ËÍcookies½«·µ»ØtrueÖµ£¬Èç¹ûä¯ÀÀÆ÷ʹÓñê×¼ÐÒéÔò·µ»ØfalseÖµ¡£
String getValue() ·µ»ØCookieµÄÖµ¡£±ÊÕßÒ²½«ÔÚºóÃæÏêϸ½éÉÜgetValue/setValue¡£
int getVersion() ·µ»ØCookieËù×ñ´ÓµÄÐÒé°æ±¾¡£
void setComm
Ïà¹ØÎĵµ£º
ÔÚ¿ª·¢ÖÐÑéÖ¤ÂëÊDZȽϳ£Óõ½ÓÐЧ·ÀÖ¹ÕâÖÖÎÊÌâ¶Ôijһ¸öÌض¨×¢²áÓû§ÓÃÌض¨³ÌÐòÆƽⷽʽ½øÐв»¶ÏµÄµÇ½³¢ÊԵķ½Ê½¡£
´ËÑÝʾ³ÌÐò°üÀ¨Èý¸öÎļþ£º
1.login.jsp:µÇ¼ҳÃæ
2.code.jsp:Éú³ÉÑéÖ¤ÂëͼƬҳÃæ
3.check.jsp:ÑéÖ¤½á¹û
code.jsp
³ÌÐò´úÂë ==================================================
<%@ page co ......
jspʹÓÃ×é¼þ½øÐÐÎļþÉÏ´«
WEBÎļþÉÏ´«¿ÉÄÜÊÇÍøÕ¾½¨ÉèÖÐ×î³£ÓõŦÄÜÖ®Ò»£¬ÎÒÔÚÏîÄ¿¿ª·¢Öм¸ºõ¶¼ÐèҪʵÏÖÎļþÉÏ´«¹¦ÄÜ£®Ç°¶Îʱ¼ä×Ô¼ºËѼ¯ÁËһЩÉÏ´«×é¼þ£®ÕâƪÎÄÕÂÖн«½éÉÜÕâЩ×é¼þµÄʹÓ÷½·¨£¬²¢ÇұȽϸ÷×ÔµÄÓÅÁÓ£®
Ò»£¬smartupload×é¼þ£®
ÎÒÏëÖ»Òª×ö¸öÎļþÉÏ´«µÄÅóÓѶ¼ÖªµÀÕâ¸ö×é¼þ£¬ÎÒÈÏʶµÄÈËÖÐʹÓÃ×î¶àµÄÒ²ÊÇËü£¡ÎÒ¸ ......
ÒòΪÊǸú×ÅÊÓƵѧϰµÄ£¬ÓкܶàÓõĶ«Î÷²»Ò»Ñù£¬µ«ÊÇ»¹ÊÇÂýÂýµÄÃþË÷³öÀ´À²£¡
1.Microsoft JDBC Driver µÄÏÂÔØ°²×°
Ö»ÒªÔÚÍøÉÏÕÒµ½×ÊÔ´Ò»²½²½À´¾Í¿ÉÒÔÁË¡£
2.ÅäÖû·¾³±äÁ¿
ÎÒÓõÄÊÇtomcat6.0Ê×ÏÈÅäµÄÊÇ
classpathºÍpath£¬ÕâЩ¶¼ÊÇÔÚÅäjdkµÄʱºò¾ÍÅä¹ýÁË£¬ËùÒԾͲ»Ïêϸ˵Ã÷ÁË£¬Ö»Òª½«libºÍbinÎļþ¼ÓÈëµ½Ïà¹Ø ......
Ò») °²×°JDK(jdk-1_5_0-windows-i586.exe)£¬Ä¬ÈÏ°²×°£»
(¶þ) °²×°Tomcat(tomcat5.5-installer.exe)£¬Ä¬ÈÏ°²×°£»
* ˳Ðò²»¿ÉÒԵߵ¹ *
(Èý) ²âÊÔ°²×°½á¹û
1. ´ò¿ªä¯ÀÀÆ÷ÊäÈëhttp://localhost:8080£¬Èç¹û³É¹¦£¬Ôò»á¿´µ½»¶ÓÒ³Ãæ¡£´Ëʱ·ÃÎʵÄ·¾¶Îª$tomcat/webapps/root/
(ËÄ) ½¨Á¢ÎÒµÄÕ¾µ ......
×Ô¶¨Òå±êÇ©ÊÇÈÿª·¢ÈËÔ±´´½¨¿Í»§»¯µÄ±êÇ©,²¢ÇÒÔÚjspÎļþÖÐʹÓÃÕâЩ±êÇ©,ÕâÑù¿ÉÒÔʹjsp´úÂë¸ü¼ò½à!
Ê×ÏÈÕâÀïÏȽéÉÜ´Ó¶¨Òå±êÇ©µ½Ê¹ÓñêÇ©µÄ²½Öè:
1,´´½¨×Ô¶¨Òå±êÇ©´¦ÀíÀà,¼°Ïà¹ØÀà.class ²¢ÇÒ°ÑËûÃǶ¼·ÅÔÚWEB-INF/classesĿ¼ÏÂ
2,´´½¨TLD±êÇ©¿âÃèÊöÎļþ(.tld)Î ......