This week's book giveaway is in the Cloud forum.
We're giving away four copies of Terraform in Action and have Scott Winkler on-line!
See this thread for details.
Win a copy of Terraform in Action this week in the Cloud forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

setMaxInactiveInterval(-1)

 
Ranch Hand
Posts: 643
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

in above i am using session.setMaxInactiveInterval(-1)?
if i set setMaxInactiveInterval(-1) then isNew() method always return
false.
i know in above code if i will use session.setMaxInactiveInterval(0) it will throws Exception.
That means if we use setMaxInactiveInterval(-1) then session will never created?

Please Help
Thanks
 
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess a negative number in setMaxInactiveInterval means that session will never expires
 
Ranch Hand
Posts: 310
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you are executing this servlet with any jsp page thats why its session.isNew() return false.If a page is loaded the container will automatically create a session.
So try to run the servlet directly from the browser.
 
Sreeraj G Harilal
Ranch Hand
Posts: 310
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes i check the code. If you run the servlet directly, it will print true.
 
Ranch Hand
Posts: 502
jQuery Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
session.setMaxInactiveInterval(-1) ==> Session never expires.

session.setMaxInactiveInterval(0) ==> is like calling session.invalidate(); session will expire after this statement completes and if you call any method on this session will result in illegalStateException.
 
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think HFSJ states in its mock exam that, even after an invalidate, we can invoke session.getServletContext() to return the context.
 
reply
    Bookmark Topic Watch Topic
  • New Topic