Beispiel #1
0
 protected void setColor(HttpServletRequest req, String color) throws ServletException {
   req.getSession().setAttribute("color", color);
 }
Beispiel #2
0
    protected String getColor(HttpServletRequest req) throws ServletException {
      HttpSession session = req.getSession(/* create */ false);
      if (session == null) return null;

      return (String) session.getAttribute("color");
    }
Beispiel #3
0
 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"));
 }