hello sri, Thanks for ur reply.... But i still have two doubts... 1) Since I am using sessions, that means defaulty I am using cookies(is it right to say), so my cookies folder in windows must have some file describing the sessions. But it is not there. 2) If my cookies are disable in a browser, wont i be able to access the session part of my application.
Sandeep Yes, the default way to manage sessions is through cookies. If cookies are disabled on the client browser then you have to manually call encodeURL() and pass it the URL to write out to the browser. Something like this:
This assumes that out is a valid PrintWriter and resp is a valid HttpServletResponse. For your first question, there might not be any cookies stored if you never created a session. Did you use HttpServletRequest.getSession(true) to get/create a session? Dont forget that you ahve to get the Session object before writing to the client. Hope this helps
Thanks Dave, But my application always uses sessions, infact one every page i display 2-3 componenets from sessions only. But in cookies folder I deleted all the cookies, and when I run my aplication(browswer), there was no new cookies. But i noticed one thing that in cookies folder there is a file index.dat, that changes whenever a new session creates(e.g.clicking first time after webserver opens). So is the index.dat resposible for maianting sessions and if yes then what bout the cookies. If not then where the cookies are stored?
Sandeep I dont know what index.dat is, did you try to open it in notepad or another text editor to see what was in it? As far as the cookies not showing up in your cookies folder or in your temp internet files folder that is most likely because the cookie is set to expire right away so your system never stores them. I would bet that your browser never even writes them to your hard drive. Is there something specific you want to do with the cookies or were you just trying to see them in action?
Thanks Dave... But our discussion moved to other way.. My question was: There is an application running on a webserver. That application uses sessions(I am storing and retriving some data from session object). When i access this apliaction from other machine say A, then there must be some cookies stored in the cookies folder of machine A.(as cookies is the default method to use sessions). But my problem is that i found no cookies saved on A. So I wanted to know why the cookies not saving? or if it is saving somewehere else, then where is it(Like index.dat)
HttpSession uses transient cookies. They are stored in memory and in in some folder. When the browser is closed the cookie dies because it is transient. If you want to use persistent cookie uwe the Cookie class. Refere the docs for more info.