k41d3n
asked on
Cookie method error
I got this method from an older jsp question:
public static String getCookieValue(String cookieName) {
Cookie[] theCookies = request.getCookies();
if (theCookies != null) {
for (int i =0; i< cookies.length; i++) {
Cookie currentCookie = theCookies[i];
if (currentCookie.getName().e qualsIgnor eCase(cook ieName)
return currentCookie.getValue();
}
}
return null;
}
but when I try to use it, I get an error on the line:
Cookie[] theCookies = request.getCookies();
that says package request does not exist.
Any ideas?
Thanks!
public static String getCookieValue(String cookieName) {
Cookie[] theCookies = request.getCookies();
if (theCookies != null) {
for (int i =0; i< cookies.length; i++) {
Cookie currentCookie = theCookies[i];
if (currentCookie.getName().e
return currentCookie.getValue();
}
}
return null;
}
but when I try to use it, I get an error on the line:
Cookie[] theCookies = request.getCookies();
that says package request does not exist.
Any ideas?
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Excellent, thank you.
I dont understand..i showed the same in my code and explained it as "request defined"
?
?
ASKER
You are absolutely correct, it's my fault I didn't read it properly.
Thanks for replying.
Please post here a Question and the moderators will re-open this Question:
https://www.experts-exchange.com/Community_Support/
:-)
Please post here a Question and the moderators will re-open this Question:
https://www.experts-exchange.com/Community_Support/
:-)
ASKER