随笔-295  评论-26  文章-1  trackbacks-0
private void bbslogin(String name,String pwd) {
  WebContext context = WebContextFactory.get();
  Cookie[] cookie1 = context.getHttpServletRequest().getCookies();
  if (cookie1 == null) {
   Cookie cookie = new Cookie("bbsUser", name);
   Cookie cookpwd=new Cookie("bbsPwd",pwd);
   cookie.setMaxAge(60*60*2);
   cookpwd.setMaxAge(60*60*2);
   cookpwd.setPath("/");
   cookie.setPath("/");
   context.getHttpServletResponse().addCookie(cookie);
  } else {
   for (int i = 0; i < cookie1.length; i++) {
    String vname = cookie1[i].getName();
    String value = cookie1[i].getValue();
    if (!vname.equals("bbsUser")) {
     Cookie cookie = new Cookie("bbsUser", name);
     Cookie cookpwd=new Cookie("bbsPwd",pwd);
     cookie.setMaxAge(60*60*2);
     cookpwd.setMaxAge(60*60*2);
     cookie.setPath("/");
     cookpwd.setPath("/");
     context.getHttpServletResponse().addCookie(cookie);
    }
   }
  }
 }


大盘预测 国富论
posted on 2008-01-21 15:32 华梦行 阅读(154) 评论(0)  编辑  收藏

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


网站导航: