protected void setColor(HttpServletRequest req, String color) throws ServletException { req.getSession().setAttribute("color", color); }
protected String getColor(HttpServletRequest req) throws ServletException { HttpSession session = req.getSession(/* create */ false); if (session == null) return null; return (String) session.getAttribute("color"); }
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { resp.setContentType("text/plain"); writeSelectMessage(req.getParameter("color"), resp.getWriter()); setColor(req, req.getParameter("color")); }