posts - 495,comments - 227,trackbacks - 0

写Cookie

     Cookie cookie = new  Cookie( " info " ,info);
     cookie.setMaxAge( 1000 );
     cookie.setPath( " / " );
     cookie.setDomain( " duxiu.com " );
     response.addCookie(cookie); 



*****************************************
读Cookie

    String info  =   " info " ;
    Cookie[]cookie  =  request.getCookies();
    Cookie cookie_request = null ;
    List list  = Arrays.asList(cookie);
    Iterator it = list.iterator();
     while (it.hasNext())
     {
     Cookie temp = (Cookie)it.next();
      if (temp.getName().equals(info))
     {
      cookie_request=temp;
      break;
    } 

    } 

    info = cookie_request.getValue();
  
posted on 2006-03-30 16:27 SIMONE 阅读(312) 评论(0)  编辑  收藏 所属分类: JSP

只有注册用户登录后才能发表评论。


网站导航: