efkw
asked on
How can I handle cookies?
Hi all,
I want to save the member login information in Cookies. After user login, the information will be auto-add to client side PC, and show it in FORM next time. Once I put the GETCOOKIES statement, it generated error when enter the site said that: java.lang.NullPointerExcep tion.
But, when the user logined before, this error will not be show. I know that it is the error about the Cookie, but, how can I know the cookies has data or not before get it?
here is my code:
String cookiemail="";
Cookie cookies[]=request.getCooki es();
for (int i=0;i<cookies.length;i++){
if(cookies[i].getName().eq uals("cook iemail")){
cookiemail=cookies[i].getV alue();
break;
}
}
please help. Thanks!
I want to save the member login information in Cookies. After user login, the information will be auto-add to client side PC, and show it in FORM next time. Once I put the GETCOOKIES statement, it generated error when enter the site said that: java.lang.NullPointerExcep
But, when the user logined before, this error will not be show. I know that it is the error about the Cookie, but, how can I know the cookies has data or not before get it?
here is my code:
String cookiemail="";
Cookie cookies[]=request.getCooki
for (int i=0;i<cookies.length;i++){
if(cookies[i].getName().eq
cookiemail=cookies[i].getV
break;
}
}
please help. Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.