package staff2.grewe.servlets; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; //MyUseHandleCookieServlet //This Servlet accepts a cookie based that //contains the client's previously specified //handle and greets them with it. //Author: L. Grewe public class MyUseHandleCookieServlet extends HttpServlet { //Handle any GET requests. //Specifically, see if there are any Cookies sent to this servlet //Looking for the myHandleCookie. If this exists, retrieve //the associated value and use it to create an HTML greeting //the client with this value. public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String handle = "New User"; //Retrieve cookies Cookie[] c = request.getCookies(); //Loop through cookie array looking for the myHandleCookie for(int i=0; i " + title + "\n" + "" + "Welcome, " + handle +"\n" + ""); } }