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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

senthil_krnCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.