Getting cookie values

Hai everybody,

I am facing a problem with cookies. Actually what i am doing is, user will enter uesrname and pasword in one url loginpage, after success , iam redirecting the user to another url.i like to get the cookie values(the first url cookies and cookies not encrypted) in redirected page for some validation.

how to get those values?

please give me some suggesttions in this issue.

thanks in advance

[437 byte] By [haiiiiiiia] at [2007-11-27 6:41:12]
# 1
You can get all cookies using HttpServletRequest#getCookies(). At the mid-bottom of http://balusc.xs4all.nl/srv/dev-jep-usf.html you can find several useful utility methods to maintain cookies.
BalusCa at 2007-7-12 18:10:44 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Hai BalusC

thanks for your reply.

suppose, here my cookie is like this:

*****************************************

First Name%7cLast Name%7cEmail%7cWork mob%7cMiddle Name%7cManagers EmpID%7cName

Suffix%7cManagers %7cPattern_A %7salCode%7 Organization Code%7cSalary Grade

**********************************************

i am new to cookies concepts, what is meant by cookie name?

in one cookie , is there so many names?(like above, first name, lastname etc all these are cookie names?)

please let me know

haiiiiiiia at 2007-7-12 18:10:44 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

Knowledge of cookies has actually nothing to do with Java knowledge, but rather with basic HTTP knowledge.

A cookie is kind of a temporary clientside storage of string values. The server as well as the client have access to them (in FireFox for example, go to options - privacy - show cookies). The server can only retrieve cookies which matches the domain name of the server. Each cookie has an identifier, the cookie name, and a value, the cookie value. Generally when developers want to put multiple values in one cookie, they uses a predefinied separator to separate the values in a predefinied order. In your case the "%7c" character is likely the separator.

BalusCa at 2007-7-12 18:10:44 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
Hai BalusC,Thanks for ur explanation, i understand to some extent.is there any cliend-side cookies and server side cookies?if there, whats the difference between the two types of cookies?waiting for answer
haiiiiiiia at 2007-7-12 18:10:44 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
Cookies are only stored on the client side. The server can read and write them.
BalusCa at 2007-7-12 18:10:44 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...