Originally posted by Sureshvasan Paramasamy:
Hi every body
What is the different between session.req.getSession(true);
and session.req.getSession();
whic is used to crate a servlet?
vasan
ReplY:
Creating a session couldn't be simpler. Off the HTTPServletRequest object, req, call:
HttpSession theSession = req.getSession(true);
That will get the current HTTPSession for the client, or create one if it doesn't already exist. If the argument value to getSession() was false, no session will be created if one doesn't already exist. The following CreateSession servlet illustrates how to create a session and glean some important session statistics such as creation time, last access time, the maximum lifetime of a session in seconds and most importantly, the session id that is used to uniquely identify a client's session.