3 Replies Latest reply: Jun 27, 2012 4:56 AM by Smitha Dsouza RSS

using cookie in jsf

Smitha Dsouza Newbie

Hi ,


can any body help with my issue.

am trying to set cookie with some value and trying to get that back.. am not getting... the list of cookies..please help me urgently..

  • 1. Re: using cookie in jsf
    Brendan Healey Master

    Well, what have you done so far?

  • 2. Re: using cookie in jsf
    Smitha Dsouza Newbie

    public void setTestCookie() {

            String cookieValue;         

         Cookie cookie = new Cookie("cookieKey", "cookieValue");






            //getting the cookies

            Cookie[] cookies = request.getCookies();//HERE AM NOT GETTING COOKIE NAME AND VALUE

            if (cookies != null) {

                  for (int i = 0; i < cookies.length; i++) {

                  if (cookies[i].getName().equals("cookieKey")) {

                      cookieValue  = cookies[i].getValue();

                      System.out.println("cookie value:"+cookieValue);

                      StringTokenizer stringSeparate=new StringTokenizer(cookieValue, "/");


                          String key = stringSeparate.nextToken();



                      }//end of while

                }//end of if

           }//end of for

         } //end of if  

       }//end of setTestCookie method


    in firefox browser cookie list,am not able to find the cookie name..

  • 3. Re: using cookie in jsf
    Smitha Dsouza Newbie

    This issue ia resolved.. cuz i had done some mistake