The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
April 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Reply - session Invalidate

Posted by Rajendrakumar on May 19, 2001 at 1:30 AM

> Hello friends,

> Here are two JSP pages

> First JSP Page
> <%
> session.setAttribute("attr",new String("It is Valid"));
> String s = (String)session.getAttribute("attr");
> out.println(s);
> out.println(session.getId());
> %>
> next

>
> Second JSP Page
> <%
> String s2 = (String)session.getAttribute("attr");
> out.println(s2);
> out.println(session.getId());
> session.invalidate();
> %>
> prev

>
> Now i have following doubts
> 1) why the attribute which was set in first page is not accesible in second
> page although the same session is continuing( as it has same ID);

> 2) Even though the second page calls session.invalidate() the session does not terminates as if you press prev button the same session ID is displayed.

>
> thanks in advance


Hai !
you are using default session object.
As per your first question the attribute set in first page is retrieved in second page perfectly.
For ur second, After invalide the session in second page when u go for first page it gives IllegalStateException....

Thanks...



Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us