Skip to content

Instantly share code, notes, and snippets.

@ilake
Created March 26, 2010 10:06
Show Gist options
  • Save ilake/344733 to your computer and use it in GitHub Desktop.
Save ilake/344733 to your computer and use it in GitHub Desktop.
@dear-lizhihua
Copy link

代碼可以美化一下
<%
  cookies = request.getCookies();
  if (cookies.length == 0 || cookies == null) {
    doStuffForNewbie();
    //沒有訪問過
  } else {
    doStuffForReturnVisitor(); //已經訪問過了
  }
% >

cookies = request.getCookies();
if (cookies.length == 0 || cookies == null) {
  out.println("Has not visited this website");
} else {
  for (int i = 0; i < cookie.length; i++) {
    out.println("cookie name:" + cookies[i].getName() + "cookie value:" +
    cookie[i].getValue());
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment