I'm trying to get the value of a cookie using tags and I'm just don't get it. (part of the problem is I just don't seem to be able to get my head around the way tags work...but that's a problem for another time) I've been through the spec several times and thought I was onto something in appendix A6 where it talks about cookies as "Implicit Objects", but no dice.

I can do it in java code, just not in tags. here's where I'm at with the java code, maybe some patient, kind-hearted, "suffers fools gladly" tag wiz can help nudge me back on the path to enlightenment.

<%
    boolean hasTakenSurvey = false;
    Cookie[] cookieList = request.getCookies();
    for (int i = 0;i<cookieList.length;i++) {
        Cookie myCookie = cookieList[i];
        out.println(myCookie.getName() + " = " + myCookie.getValue());
        if (myCookie.getName().equals("hots")) {
            // the user has the cookie
            hasTakenSurvey = true;
        }
    }
    if (!hasTakenSurvey) {
        Cookie myCookie = new Cookie("hots","true");
        response.addCookie(myCookie);
    }
%>

What I want to do (ultimately) is display a thank you message if a person has taken the survey (as evidenced by the presence of the "hots" cookie) or display the survey itself if they haven't.

Any help would be greatly appreciated....I'm going to understand these things someday.

Jeff


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to