Regarding HttpSession

hi,  
  In the servlet I am using HttpSession object for keep track of userid and password.In the html file I am having two options one is for new user and other one is for exising user.
   If the user is new he can signon and he can logon immeidately using id and password.In the signon servlet I am writing the data in to session object.The same object I am getting again in the logon servlet and I am displaying the userid and password.But when I am directly entering into the logon page,in the logon servlet it is giving null pointer exception when I am getting session object even though I have given the existing user details.But it is working fine if i will go to signon page and then logon page it is working.
  Why?When HttpSession object will get expired.Is there any lifetime restriction?
g_senthilkumarAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
senthil_krnConnect With a Mentor Commented:
Hi  senthil,

I guess ur creating HttpSesion object in the signon servlet and assinging the userdetails. and using this in logon servlet.
so if u access the logon servlet directly ,the server not able to find the object thats why its giving Null pointer Exception.
Thnaks
0
 
g_senthilkumarAuthor Commented:
Hi senthil,
   I did extacly the same thing as you told.But in cookie you can access the cookie information in any page once you specified correct domain pattern.So if am giving the domain pattern as ".senthi.com",and path as "/",then any page in that site can access the cookie information.
   So I think the same thing is not possible with session.Is it correct pls give me the details.

0
 
blairdyeCommented:
Are you putting your session information in your session using
mySession.putValue("loginName" loginName);

Can you post the relavant code?

Blair
0
 
g_senthilkumarAuthor Commented:
hi all,
  I got clear about that.Thanks for all your comments.
0
All Courses

From novice to tech pro — start learning today.