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

Java¶Áдcookie

ת×Ô£ºhttp://www.blogjava.net/action/archive/2007/04/10/109574.html
         http://www.javaeye.com/topic/232662
1.ÉèÖÃCookie
1Cookie cookie = new Cookie("key", "value");
2cookie.setMaxAge(60); //ÉèÖÃ60ÃëÉú´æÆÚ£¬Èç¹ûÉèÖÃΪ¸ºÖµµÄ»°£¬ÔòΪä¯ÀÀÆ÷½ø³ÌCookie£¨ÄÚ´æÖб£´æ£©£¬¹Ø±Õä¯ÀÀÆ÷¾ÍʧЧ¡£
3cookie.setPath("/test/test2"); //ÉèÖÃCookie·¾¶£¬²»ÉèÖõĻ°Îªµ±Ç°Â·¾¶£¨¶ÔÓÚServletÀ´ËµÎªrequest.getContextPath() + web.xmlÀïÅäÖõĸÃServletµÄurl-pattern·¾¶²¿·Ö£©
4response.addCookie(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*24*365);
optioncookie.setMaxAge(60*60*24*365);
    
response.addCookie(namecookie);
response.addCookie(passwordcookie); 
response.addCookie(optioncookie); 
 2.¶ÁÈ¡Cookie
11//¸Ã·½·¨¿ÉÒÔ¶ÁÈ¡µ±Ç°Â·¾¶ÒÔ¼°“Ö±½Ó¸¸Â·¾¶”µÄËùÓÐCookie¶ÔÏó£¬Èç¹ûûÓÐÈκÎCookieµÄ»°£¬Ôò·µ»Ønull
22Cookie[] cookies = request.getCookies();
/*
 * ¶Ácookie
*/
Cookie[] cookies = request.getCookies();
if(cookies!=null)
{
    String name = "";
    String password = "";
    String option = "";
    for (int i = 0; i < cookies.length; i++)
    {
       Cookie c = cookies[i];     
       if(c.getName().equalsIgnoreCase("name"))
       {
          name = c.getValue();
        }
        else if(c.getName().equalsIgnoreCase("password"))
   &nbs


Ïà¹ØÎĵµ£º

ʹÓÃjava ¼àÌýÆ÷ʵÏÖÔÚÏßÈËÊýͳ¼Æ

 
1£®  ÔÚ¹¤³ÌÖд´½¨¼àÌýÀàSessionListener ²¢ÇÒʵÏÖHttpSessionListener½Ó¿Ú£¬´úÂëÈçÏÂ
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;
 
public class SessionListener implements HttpSessionListener {
 
    private static ......

Thinking in Javaѧϰ±Ê¼Ç£¨Ò»£©

ÔÚjava³ÌÐòÖУ¬ÍòÊÂÍòÎï½Ô¶ÔÏ󣬼´Ê¹ÊÇjava³ÌÐò±¾Éí£¬Ò²ÊÇÒ»¸ö¶ÔÏó
Ò»¡¢ReferenceÊDzÙ×ݶÔÏóÖ®Ô¿³×
             cÓïÑÔÖÐÊÇʹÓÃÖ¸ÕëÀ´²Ù×ݶÔÏóµÄ£¬µ«ÊÇjavaÄØ£¿ÓõÄÊÇreferenceÀ´²Ù×ݶÔÏó£¬ÎÒÏ°¹ß°ÑËû½Ð×ö¾ä±ú£¬¾ä±úºÍ¶ÔÏóµÄ¹Øϵ¾ÍÏëÊǵçÊÓÒ£¿ØÆ÷ºÍµçÊÓ»ú ......

Thinking in Javaѧϰ±Ê¼Ç£¨¶þ£©

ÎÒ¸öÈËÀí½â³õʼ»¯ºÍÇåÀíµÄ¹Øϵ¾ÍÊdzԷ¹ºÍÉϲÞËù£¬ÕýÊÇÓÐÁ˳õʼ»¯µÄ¶ÔÏó£¬ÎÒÃDzÅÄÜʹÓÃÇåÀí¡£µ«ÊÇΪʲôҪÇåÀíÄØ£¿ÏëÏóÒ»ÏÂÒ»¸öÈ˹â³Ô²»À­£¬ÊǸöʲôÇé¿ö£¿£º£©ÄѵÀÎÒÃǵijÌÐòÒ²ÒªÏñ³Ô·¹Ò»Ñù¹â²úÉú¶ÔÏ󣬶ø²»È¥ÇåÀíʹÓÃÍê±ÏµÄ¶ÔÏó£¿ÈÎÓÉÎÒÃǵĶÔÏó¶Ñ»ýÈçɽ£¬Õ¼ÓÃϵͳ×ÊÔ´£¿
   ÒÔ¹¹Ô캯ÊýÈ·±£³õʼ»¯µÄ½øÐÐ
&nb ......

JavaƵµÀר¼ÒרÀ¸ÉÏÏß Ê×ÆÚÈÈÆÀJava7ÐÂÌØÐÔËÄ´óÌåÑé

¾àÀëJava7µÄMR°æ±¾·¢²¼ÓжÎʱ¼äÁË£¬Í¨¹ý°²×°ÊÔÓÃÖ®ºóµÄ×ÜÌå¸Ð¾õÊÇ£ºËÙ¶ÈÓÖ¿ìÁË¡£×ÐϸÔĶÁÁËJava7µÄÏà¹ØÎĵµ·¢ÏÖ£¬Java7ÓµÓÐÈçϵÄһЩеÄÌØÐÔ¡£
Ê×ÏÈÊÇÄ£¿é»¯ÌØÐÔ£ºÈç¹ûÄú°²×°ºÍʹÓùýNetBeans6.7µÄ»°£¬ÊDz»ÊÇ»áÓÐÒ»¸öºÜ´óµÄ¸Ð¾õ£¬¾ÍÊÇNetBeans6.7µÄÆô¶¯ËٶȱÈÒÔÇ°¿ìÁ˺ܶ࣬µ±È»²¢²»ÊÇNetBeansÒѾ­Ê¹ÓÃÁËJava7£¬¶øÊÇNetB ......

ʵ¼ùJavaÖУ¬Jniµ÷ÓÃDLLÎļþ±¾µØ·½·¨

JavaÖУ¬Jniµ÷ÓÃDLLÎļþÊÔÑé
 
ËùÓÐÎļþ¾ùÔÚE:\·¾¶Ï¡£
°²×°jdk1.6.0_07
°²×°ÁËVC++6.0
µÚÒ»²½£¬
HelloWorld.java
µÚ¶þ²½£¬
E:\>javac HelloWorld.java
µÃµ½
HelloWorld.class
µÚÈý²½£¬
E:\>javah HelloWorld
µÃµ½
HelloWorld.h
µÚËIJ½£¬
±àдһ¸öCÎļþ
HelloWorldImp.c
µÚÎå²½£¬
ʹÓÃcl±àÒ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ