--- CookieExample.java.orig Wed Mar 19 10:17:48 2003 +++ CookieExample.java Tue Jul 01 00:34:48 2003 @@ -14,6 +14,7 @@ * Example servlet showing request headers * * @author James Duncan Davidson + * @author Stefan Radzom */ public class CookieExample extends HttpServlet { @@ -26,6 +27,14 @@ { response.setContentType("text/html"); + String cookieName = request.getParameter("cookiename"); + String cookieValue = request.getParameter("cookievalue"); + Cookie aCookie = null; + if (cookieName != null && cookieValue != null) { + aCookie = new Cookie(cookieName, cookieValue); + response.addCookie(aCookie); + } + PrintWriter out = response.getWriter(); out.println(""); out.println(""); @@ -66,11 +75,7 @@ out.println(rb.getString("cookies.no-cookies")); } - String cookieName = request.getParameter("cookiename"); - String cookieValue = request.getParameter("cookievalue"); - if (cookieName != null && cookieValue != null) { - Cookie cookie = new Cookie(cookieName, cookieValue); - response.addCookie(cookie); + if (aCookie != null) { out.println("

"); out.println(rb.getString("cookies.set") + "
"); out.print(rb.getString("cookies.name") + " "