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

cokie¼¼ÊõÔÚJava MEƽ̨µÄÓ¦ÓÃÓëʵÏÖ

CookieÔÚWebÓ¦ÓóÌÐòÖб»¹ã·º²ÉÓã¬Î¬»¤ä¯ÀÀÆ÷ºÍ·þÎñÆ÷Ö®¼äµÄ״̬¡£Òź¶µÄÊÇÕâÒ»ÌØÐÔÔÚJava
MEƽ̨Öв¢Ã»Óеõ½Ö§³Ö¡£Òò´Ë£¬ÒªÏëά³Ö¿Í»§¶ËºÍ·þÎñÆ÷¶ËµÄ״̬Ôò±ØÐëʹÓÃURLÖØдµÄ·½Ê½¡£URLÖØд²Ù×÷ÆðÀ´±È½ÏÂé·³£¬ËùÒÔÑо¿Ò»ÏÂcookieµÄ
Ô­Àí²¢ÔÚJava MEƽ̨ÉÏʵÏÖcookieÊDz»´íµÄ³¢ÊÔ¡£
Ê×ÏÈ£¬ÎÒÃÇÀ´¿´Ò»ÏÂcookieµÄÔ­Àí¡£µ±·þÎñÆ÷ÐèÒªºÍä¯ÀÀÆ÷ά³Öijһ״̬µÄʱºò£¬ÀýÈçÐèÒª¼Ç¼Óû§µÄ¹ºÎï³µÖÐÒѾ­¹ºÂòµÄÉÌÆ·¡£Õâʱºò·þÎñÆ÷¿ÉÒÔÐÂ
½¨Ò»¸öCookie²¢°ÑËüдÈëµ½ÏìÓ¦ÖУ¬ä¯ÀÀÆ÷´ÓÏìÓ¦ÖнÓÊÕµ½cookie²¢±£´æÆðÀ´¡£µ±ä¯ÀÀÆ÷ÔÙ´ÎÏò·þÎñÆ÷·¢ËÍÇëÇóµÄʱºò£¬ä¯ÀÀÆ÷»á¸ù¾ÝÓò
£¨domain£©ºÍ·¾¶£¨path£©¼ì²éÊÇ·ñÓÐÆ¥ÅäµÄcookie£¬Èç¹ûÓÐÔò°ÑcookieÒÔ“Ãû³Æ=Öµ”µÄÐÎʽ·¢Ë͸ø·þÎñÆ÷£¬·þÎñÆ÷´ÓÇëÇóÖнâÎö³ö
cookie¾ÍÖªµÀÓû§µÄ״̬ÁË¡£ÄÇô£¬ä¯ÀÀÆ÷¸ù¾Ýʲô¹æÔòÀ´¾ö¶¨Ïò·þÎñÆ÷·¢ËÍcookieÄØ£¬Ê×ÏÈҪƥÅädomain£¬Èç¹ûcookieµÄÓòÊôÐÔÊÇ.
google.com£¬ÄÇôÇëÇóÖ¸Ïòj2medev.comµÄʱºò£¬cookie¾Í²»»á±»·¢ËÍ¡£Èç¹ûÓòÆ¥ÅäµÄÌõ¼þÂú×㣬ÔòÅжÏpathÊÇ·ñÆ¥Å䣬Èç¹û
cookieµÄpathÊôÐÔÊÇÇëÇóµÄuriµÄ¸¸Ä¿Â¼µÄ»°£¬ÄÇôcookie¾Í»á±»·¢Ë͸ø·þÎñÆ÷¡£CookieÊÇÓдæ»îÖÜÆڵģ¬µ½ÆÚµÄcookie»á±»ä¯ÀÀ
Æ÷×Ô¶¯Çå³ý¡£Èç¹û·þÎñÆ÷´´½¨cookieµÄʱºò²»ÉèÖÃÉúÃüÖÜÆÚ£¬ÄÇôÔڻỰ½áÊøºóä¯ÀÀÆ÷¾Í»áɾ³ýcookie¡£Èç¹û²»ÎªcookieÖ¸¶¨pathÊôÐÔ£¬ÄÇ
ôĬÈϾÍÊÇÕâ´ÎÇëÇóµÄ·¾¶¡£
cookieÔںܶàwebÓ¦ÓóÌÐòÖж¼ÓÐÓ¦Ó㬱ÈÈç¼ÇסÃÜÂ룬¹ºÎï³µµÈ¡£ÔÚ¿ª·¢MIDletµÄʱºò£¬ÄãÒ²¿ÉÒÔÈÃÄãµÄÓ¦ÓóÌÐòÖ§³Öcookie£¬ÕâÑù
ά³Ö¿Í»§¶ËÓë·þÎñÆ÷¶ËµÄ״̬½«±äµÃ¼òµ¥£¬ÎªÄ㼯Öо«Á¦½â¾öÆäËûÒµÎñ·½·¨µì¶¨ÁË»ù´¡¡£¼ÈÈ»ÒѾ­ÖªµÀÁËcookieµÄ¹¤×÷Ô­Àí£¬ÄÇô¾ÍÓ¦¸Ã¿¼ÂÇÒ»ÏÂÔÚJava
MEƽ̨ÈçºÎʵÏÖcookie£¬Õâ¸öÏë·¨ÊÇ·ñ¿ÉÐС£ÎÒ½«´ÓÏÂÃæÈý¸ö·½Ãæ½øÐзÖÎö¡£
µÚÒ»£º»ñµÃcookie
µ±·þÎñÆ÷¶ËµÄÏìÓ¦µ½À´µÄʱºò£¬ÎÒÃÇÓ¦¸ÃÄܹ»¶ÁÈ¡cookie¡£Èç¹û·þÎñÆ÷Ïò¿Í»§¶ËдÈëCookieµÄʱºò£¬ÏìÓ¦ÖеÄHTTPÍ·“Set-
Cookie”Öлá°üº¬Ò»¸ö×Ö·û´®£¬´ú±íÁËcookieµÄÐÅÏ¢¡£ÐÒÔ˵ÄÊÇÎÒÃÇÊÇÓÃHttpConnection.getHeaderFiled("Set
-Cookie")·½·¨¼´¿É»ñµÃcookie£¬µ«ÊÇÐèҪעÒâÕâÀïÖ»ÊǶÁÈ¡ÁËÒ»¸öcookie£¬Èç¹ûÏìÓ¦Öаüº¬Á˶à¸öcookie£¬ÄÇôÄãÐèҪѭ»·¶ÁÈ¡¡£Àà
ËÆÓÚÏÂÃæµÄ´úÂë
                String sCookie = null;
    


Ïà¹ØÎĵµ£º

½âÎöJavaÀàºÍ¶ÔÏóµÄ³õʼ»¯¹ý³Ì

ÀàµÄ³õʼ»¯ºÍ¶ÔÏó³õʼ»¯ÊÇ JVM ¹ÜÀíµÄÀàÐÍÉúÃüÖÜÆÚÖзdz£ÖØÒªµÄÁ½¸ö»·½Ú£¬Google ÁËÒ»±éÍøÂ磬ÓйØÀà×°ÔØ»úÖƵÄÎÄÕµ¹ÊDz»ÉÙ£¬È»¶øÀà³õʼ»¯ºÍ¶ÔÏó³õʼ»¯µÄÎÄÕ²¢²»¶à£¬ÌرðÊÇ´Ó×Ö½ÚÂëºÍ JVM ²ã´ÎÀ´·ÖÎöµÄÎÄÕ¸üÊÇÏÊÓÐËù¼û¡£
±¾ÎÄÖ÷Òª¶ÔÀàºÍ¶ÔÏó³õʼ»¯È«¹ý³Ì½øÐзÖÎö£¬Í¨¹ýÒ»¸öʵ¼ÊÎÊÌâÒýÈ룬½«Ô´´úÂëת»»³É JVM ×Ö½ÚÂëºó£¬ ......

JavaÓ¦Óü¼ÇÉ£º¶ÔÓÚ Cookie µÄ²Ù×÷Ïê½â


1.ÉèÖÃCookie
Cookie cookie = new Cookie("key", "value");
cookie.setMaxAge(60);
ÉèÖÃ60ÃëÉú´æÆÚ£¬Èç¹ûÉèÖÃΪ¸ºÖµµÄ»°£¬ÔòΪä¯ÀÀÆ÷½ø³ÌCookie(ÄÚ´æÖб£´æ)£¬¹Ø±Õä¯ÀÀÆ÷¾ÍʧЧ¡£
cookie.setPath("/test/test2");
ÉèÖÃCookie·¾¶£¬²»ÉèÖõĻ°Îªµ±Ç°Â·¾¶(¶ÔÓÚServletÀ´ËµÎªrequest. ......

ÕýÔò±í´ïʽÔÚphp£¬java£¬javascriptÖзֱðÓ¦ÓÃ

ÔÚjavascriptÖÐÓ÷¨¾ÙÀý
var rule = /^\d+$/;
if(!rule.test(addform.rmb_price.value)) {
alert('rmb_price must be number');
addform.rmb_price.focus();
return false;
}
ÔÚphpÖÐÓ÷¨¾ÙÀý
$aa = "/^\d+$/";
if(preg_match($aa, "111")) {
echo "found";
}
ÔÚjavaÖÐÓ÷¨¾ÙÀý ......

javaºÍphpÎļþ¶Áд¶Ô±È¾ÙÀý¼°½â¾öÈÃÈËÍ·Í´µÄÂÒÂëÎÊÌâ

JAVAÎļþ¶Áд±ØÐëҪעÒâ±àÂëÎÊÌâ 
 javaµÄÎļþд
Ö±½ÓʹÓÃFileWriter¼´¿É£¬µÚ¶þ¸ö²ÎÊýΪ׷¼ÓдÈ룬ĬÈÏÊǸ²¸Çд¡£Ð´Íê±ØÐëclose²Å»á±£´æдºÃµÄÄÚÈÝ¡£
ĬÈÏÇé¿öÈç¹ûûÓлáн¨Ò»¸öÎļþ
FileWriter fw = null;
try {
fw = new FileWriter("/data/updatetime.dat", true); // true×·¼ÓдÈë
fw.append ......

±ÜÃâÔÚJavaÖÐʹÓÃChecked Exception

JavaµÄException·ÖΪÁ½À࣬һÀàÊÇRuntimeException¼°Æä×ÓÀ࣬ÁíÍâÒ»Àà¾ÍÊÇchecked
Exception¡£JavaÒªÇóº¯Êý¶ÔûÓб»catch´¦ÀíµôµÄchecked
Exception£¬ÐèÒª½«ÆäдÔÚº¯ÊýµÄÉùÃ÷²¿·Ö¡£È»¶ø£¬ÕâÒ»ÒªÇó³£³£¸ø³ÌÐòÔ±´øÀ´Ò»Ð©²»±ØÒªµÄ¸ºµ£¡£
ΪÁ˱ÜÃâÔÚº¯ÊýÉùÃ÷ÖÐдthrows²¿·Ö£¬ÔÚJavaÏîÄ¿ÀïÃæ³£³£¿ÉÒÔ¿´µ½ÒÔÏ´úÂëÓÃÀ´‘Í ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ