File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

tomcat session object problem

 
allen catadman
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
test.jsp
<%
session.setAttribute("test","
test");
%>
<a href="testsub.jsp">testsub</a>

testsub.jsp
<%
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
test->test
test->null
 
Dawn Charangat
Ranch Hand
Posts: 249
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
clicking X of the browser
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you are just closing the browser . it doesnt mean that you are invalidating the session
 
allen catadman
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic