1. If we set setMaxInactiveInterval(int interval) to high value,does it mean the user's information will be maintained , after a user exits a browser and reopens the browser again.
3. For getSession(true), it will check whether there is a session already existing for the user. If a session is existing, it will return that session object, otherwise it will create a new one and returns it.
And for getSession(false), this will check whether a session exists or not. If yes, then it returns that session object, or else it will return null.
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12266
1
posted
0
1. If we set setMaxInactiveInterval(int interval) to high value,does it mean the user's information will be maintained , after a user exits a browser and reopens the browser again.
A session is only good for a single browser session just like the name implies. Note that the only user information in a session is what the programmer puts there, nothing is put there automatically.
Just to clear my doubt, How many ways we can create a session in Servlet ? Is there any other way except request.getSession() call ?
Thanks,
Rahul
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35224
7
posted
0
As to #2, yes, you can write a servlet that way. But you'd have to duplicate everything GenericServlet and HttpServlet do, and in particular you'd need to implement the "service" method and its handling of the various HTTP methods.
You can create a session in a servlet by calling getSession() or the overloaded method that takes a boolean, with a value of 'true' on the request object.
BTW, This information is readily available in the API or in the FAQ here.
Rahul Nair wrote:Hello,
Just to clear my doubt, How many ways we can create a session in Servlet ? Is there any other way except request.getSession() call ?
Thanks,
Rahul
Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
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.