JSP : how can directly get the value of a specified cookie namewithout using a loop FROM the header.

Discussion in 'Java' started by stunaz, Nov 29, 2010.

  1. stunaz

    stunaz Guest

    In my jsp page i have put

    ${header.cookie}

    and I got this :

    JSESSIONID=1bxvxsg61zphc; JSESSIONID=385a85a4ad8a3041ee047d586447;
    treeForm:tree-hi=treeForm:tree:applications; clientLanguage=fr

    My question is, how can directly get the value of a specified cookie
    name without using a loop, for example: if i want to get the value of
    the clientLanguage. I especially want to get value fromheader.cookie
    not fromcookie itself.
    thank you for any advise.
     
    stunaz, Nov 29, 2010
    #1
    1. Advertising

  2. stunaz

    Guest

    Re: JSP : how can directly get the value of a specified cookie name without using a loop FROM the header.cookie ?

    stunaz <> wrote:
    > In my jsp page i have put


    > ${header.cookie}


    > and I got this :


    > JSESSIONID=1bxvxsg61zphc; JSESSIONID=385a85a4ad8a3041ee047d586447;
    > treeForm:tree-hi=treeForm:tree:applications; clientLanguage=fr


    > My question is, how can directly get the value of a specified cookie
    > name without using a loop, for example: if i want to get the value of
    > the clientLanguage. I especially want to get value fromheader.cookie
    > not fromcookie itself.
    > thank you for any advise.


    Sorry, you need to call HttpServletRequest.getCookies(), then iterate
    through the array of Cookie using getName() to find the cookie you
    want and getValue() to return its value.
     
    , Dec 15, 2010
    #2
    1. Advertising

  3. stunaz

    code learner

    Joined:
    Dec 24, 2010
    Messages:
    19
    Hi stunaz,

    you can try with this
    ${cookie.clientLanguage.value}

    bye
    learner
     
    code learner, Dec 24, 2010
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ken
    Replies:
    1
    Views:
    282
    John J. Lee
    Apr 1, 2007
  2. George
    Replies:
    8
    Views:
    338
    Eric Sosman
    Jul 12, 2007
  3. Eric Mahurin
    Replies:
    2
    Views:
    281
    Takaaki Tateishi
    Apr 16, 2005
  4. ctbang
    Replies:
    1
    Views:
    160
    Thomas 'PointedEars' Lahn
    Jan 20, 2006
  5. Isaac Won
    Replies:
    9
    Views:
    460
    Ulrich Eckhardt
    Mar 4, 2013
Loading...

Share This Page