package cs320.servlet; import java.io.IOException; import java.io.PrintWriter; import java.util.List; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import cs320.model.GuestBookEntry; @WebServlet("/AddCommentWithCookie") public class AddCommentWithCookie extends HttpServlet { private static final long serialVersionUID = 1L; int idSeed = 100; public AddCommentWithCookie() { super(); } private String getName( HttpServletRequest request ) { Cookie[] cookies = request.getCookies(); if( cookies != null ) for( Cookie cookie : cookies ) if( cookie.getName().equals( "name" ) ) return cookie.getValue(); return null; } protected void doGet( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException { response.setContentType( "text/html" ); PrintWriter out = response.getWriter(); out.println( "