How we can check in particular page the session will be
alive or not
Answers were Sorted based on User's Feedback
Answer / ruchi
when we create session , we write
HttpSession session= res.getSessionn(true);
this checks whether there is a session bind on associated
request.if yes then it returns reference to session
object,otherwise create a session for associated request.
but if we want check that session is alive or not then we
write
HttpSession session= res.getSessionn(false);
this checks whether there is a session bind on associated
request.if yes then it returns reference to session
object,otherwise it returns null reference.
Is This Answer Correct ? | 9 Yes | 1 No |
Answer / aseet padhi
U can use request.getSession(false); method in
HttpServletRequest interface.It returns the HttpSession
associated with this request or null if the request has no
valid session.
Is This Answer Correct ? | 10 Yes | 3 No |
Answer / venkata rao g
Hi ,
I think is alive() is the method of the thread.
iam assuming it is correct "if the page will be there for a
specified amount of time or until the browser will be
closed or until the user log's out" the session is there.
if u have the better solution plz send to my mail id
Is This Answer Correct ? | 3 Yes | 9 No |
How to make sure a servlet is loaded at the application startup?
hi.... i have problem in running of servlet. i am using Tomcat server in my pc.. The problem is when i am click on strat it will display like below FAIL - Application at context path /first could not be started.. How i can slove the problem.. help plz
What are the different ways we can maintain state between requests?
Why is servlet used?
Name the packages that work with servlet?
What are common tasks performed by Servlet Container?
Directive Include and Action Include how both are working in JSP, what is the difference between both?In which suituation we have to choose these elements?
What do you mean by url pattern in servlet?
where the generated jsp source file are stored?
How values can be passed from HTML page to servlet?
How do you run a servlet?
How can I share objects across different sessions?