<%@ page import="java.io.*" %> <%@ page import="java.net.*" %> <%@ page import="java.util.Enumeration" %> <% // The member confirmation page is served in the same response as the cookie // and doesn't catch the cookie, so we add a request attribute to make sure // the widget changes straight away. String justIn = (String)request.getAttribute("justSignedIn"); String justOut = (String)request.getAttribute("justSignedOut"); boolean signedin = false; if (justIn != null) { signedin = true; } else if (justOut != null) { signedin = false; } else { Cookie myCBCCookie = null; String cookieName= "MyCBCSignIn"; Cookie[] cookies = request.getCookies(); if (cookies != null) { for (int i = 0; i < cookies.length; i++) { if (cookies[i].getName().equals(cookieName)) { signedin = true; break; } } } } %> <% if (signedin) { %> Your membership Sign out <% } else { // originURL = request.getRequestURL() would be simpler, but won't work on Tomcat 3.3 String host = "http://" + request.getHeader("Host"); String originURL = host + request.getRequestURI(); %> Become a member Sign in <% } %>