This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSP and the fly likes tomcat session object problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "tomcat session object problem" Watch "tomcat session object problem" New topic

tomcat session object problem

allen catadman

Joined: Apr 16, 2009
Posts: 7
<a href="testsub.jsp">testsub</a>

String test = (String)session.getAttribute("test");
System.out.println("test ->"+test);

working environment : tomcat 5.5/6 or jboss 4.2 / firefox/safari i doubt my apache is also running..
browser 1
1.) hit test.jsp
2.) click testsub link
3.) console output: test->test
4.) close browser

open new browser 2
1.) hit testsub.jsp
2.) console output still: test->test but should be test->null

question: tested in RAD -> OK

1. any setup to server.xml?

expected console output should
Dawn Charangat
Ranch Hand

Joined: Apr 26, 2007
Posts: 249
Just a small clarification required :

By opening a new browser, did you mean opening a new tab in the already existing browser ? In that case, the session will be shared.
allen catadman

Joined: Apr 16, 2009
Posts: 7
clicking X of the browser
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

you are just closing the browser . it doesnt mean that you are invalidating the session
allen catadman

Joined: Apr 16, 2009
Posts: 7
yup. but how come it works fine in RAD. the session should not be reuse when i open a new browser...

if thats the case if i login store the user bean into the session.. close the browser, open a new browser access the page i am automatically login because the session is still there?
allen catadman

Joined: Apr 16, 2009
Posts: 7
i got it.. in mac osx i should command Q not just click X.. at work we use windows/RAD thats why it works.. my mistake i should use command Q totally exit safari/firefox not just click X.. so i still into tomcat..
It is sorta covered in the JavaRanch Style Guide.
subject: tomcat session object problem
Similar Threads
Converting '&#1588;' to ش
Page refresh after Action execute
overriding static methods
Regardind null....
java coding problem ~ system.out.println