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 new session while refreshing the page. 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 "new session while refreshing the page." Watch "new session while refreshing the page." New topic

new session while refreshing the page.

prateekprateek narang

Joined: Dec 13, 2003
Posts: 1
hi group,
i've one login.jsp file where i'm creating a new session and setting the inactive time to 10 seconds. the code for this is

after that i forward the page to test1.jsp

my problem is that when i reach this test1.jsp page and leave it inactive for 10 seconds and then refresh, it prints "making new session". could any body tell me why it happens???
i also have test2.jsp. and i reach on this file by clicking on the anchor provided in test1.jsp.

which shows the perfect results. why it happens at one file while another file shows the perfect results.
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 12761
I'm not sure that I understand what your problem is, but in the first case, the session is new because it was just created. The isNew method returns true which the ! reverses so you see the else output "making new session".
The session won't be considered "old" unless it has been recovered by the servlet engine using a cookie from the browser.
I agree. Here's the link:
subject: new session while refreshing the page.
Similar Threads
How to disable cookies
Page is still executed even after response.sendRedirect()
Session object doubt
Problem with session.invalidate()
calling a java Script file into the Jsp