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

S

stunaz

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.
 
L

lmulcahy

stunaz said:
In my jsp page i have put

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top