• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

session handling

Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my jsp page i am using one java bean in session scope.user can select any number of records randomly across the page and can finally submit for cancellation of all the selected records(Across the page).After submitting i will show the success page.
here my problem is when to remove that object from session.
If i am removing object from session on launch of success page then if user clicks on browser back it will show the previous page and if he is trying to submit again or clicking on page links page will throw error(null poinet error).
can any one suggest solution for this
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Two choices as I see them:
1-put a bit of JavaScript on the top of each page that forces the page to reload each time its accessed, then when they go back, they'll find out that their session has expired, and they need to login again.
2-put 'session = request.getSession(true);' on top of each page, this way, if they access a page and their session has expired, it will just grab them another. THEN check session.isNew() to determine if they just got a new session, if they did -- then you know not to try to process the parameters sent... 'cause the session object won't be there.
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
u can also use this

then u won't get nullpointer problem
You've gotta fight it! Don't give in! Read this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic