Hi, Imagine yourself as the Bartender of this forum and people kept asking you questions, except, nobody is giving you their names. You wouldn't be sure who is asking what. It would help to remember who is who if you can somehow give a unique token to each guy who posts a question. Then, when he comes back, he can show you the token you gave him, and since it's unique, you know exactly who he is. You can recognize him now. HTTP is a stateless protocol and basically, a client makes a request, the server responds, and then that's it. If the same client makes a second request (like, clicking "Refresh", or whatever), the server has no way of knowing it was the same client before. Unless the server gives the client a token. A session object is an abstraction of this "token". It's the servlet's way of maintaining state (in the form of attributes) in a stateless protocol. In cruder terms, you can imagine a session object as a "shopping cart" of data that you load/unload (or more correctly bind/unbind) with setAttribute()/getAttribute() methods, as your client navigates through the JSPs and servlets of your web application. For more information, I recommend you check the methods of the javax.servlet.http.HttpSession class in your Servlet API docs. -anthony
aftab lal
Greenhorn
Joined: Mar 23, 2002
Posts: 2
posted
0
============= when your servlet executes code HttpSession ses=request.getSession(); The container creates the session object which will only be available when you are using the same browser and when you execute this servlet by opening another browser new session object will be created so session object is bind to browser. ========== And you can place objects in HttSession Object by sess.setAttribute("users",new Vector()); so it gives more controll over servlets. ========= please can anyone correct me if i am wrong.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.