2 Replies Latest reply on Jun 1, 2010 8:21 AM by heba fathy

    Cookie in seam

    heba fathy Newbie

      i am working on seam project . i need to add cookie to use it through the application .
      I asking if seam enable general use of  cookie and if true how can i add cookie????????

        • 1. Re: Cookie in seam
          bb bb Master
          Try these lines for add an entry to the cookie:

               Cookie cookie = new Cookie("name",id);
               ((HttpServletResponse) facesContext.getExternalContext().getResponse()).addCookie(cookie);

          And these lines for retrieve an entry from the cookie:

          for (Cookie cookie : ((HttpServletRequest) facesContext. getExternalContext() .getRequest()).getCookies()) {
          • 2. Re: Cookie in seam
            heba fathy Newbie

            Balázs Bakai thanks for your replay.
            i tried  this code but the length of the cookies array is 1
            and this cookie is jsessionid
            Unfortunately there is no cookie added.