• Post Reply Bookmark Topic Watch Topic
  • New Topic

session handling

 
Jotty Tharakan
Greenhorn
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
George
 
Jessica Sant
Sheriff
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.
 
prabhat kumar
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!