Hi Everyone,
I need some help in Cookie. I have created a servlet, where i need to create a cookie which will hold value some of user id which is given in a login page. Code of the login page is not available, only url is known. Along this url a return url is added. After successful validation servlet will redirect to that return url. This login page is invoked from my servlet only.
Can any one suggest a way, by which I can capture the required information in side a Cookie.
N.B: I have tried Cookie[] cookie=request.getCookies(); and it's not working.
Is anything other than your Serlvet accessing this Cookie? What initially created the Cookie?
If you are looking at a pure-servlet solution, look instead at HttpServletRequest.getSession(boolean). This is a higher-level way to create session-persistent data in servlets. The getCookies() method is more low-level, and returns any Cookie data specifically sent from the browser (say if you created a Cookie using JavaScript).
OCPJP
In preparing for battle I have always found that plans are useless, but planning is indispensable. -- Dwight D. Eisenhower
Hi,
If you want to store your value in client browser then use cookie.
That should work , the work flow is for the first request the client will not have the value in cookie but after that you will have that value in cookie .
Debajyoti Kundu
Greenhorn
Joined: Sep 14, 2011
Posts: 11
posted
0
Hi Pete, Miku
Thanks for your suggestions. Few days ago I just came to know that value of the cookies were encrypted and the original value can be retrieved after following some formalities.