Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Daryl Butler   on Jul 25 In Java Category.

  
Question Answered By: Jawwad Akram   on Jul 25

This is strange! If you put some thing in the session  by using,
Session.setAttribute(“user_name”, “SampleUser”);

Then this session should be available and will always be accessible by session.getAttribute(“user_name”). So this will return SampleUser or null, if session expired. You can remove session attribute by session.removeAttribute(“user_name”).
So, all pages  should get same result when you call session.getAttribute(“user_name”), it does not depend on where you call this method.
Do you use back button?! I think you problem  may accrue in below sequence:
1) You login  to system by user  X
2) You click logout.
3) You click Browser Back button.
4) You see the cached page  which still says, hi ‘x’.
5) You press refresh and now the page actually requested from server.
Well, if this is the case you must handle it by writing a filter on your server and some javascript and meta data in your jsp  page.

Share: 

 

This Question has 6 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on maintain session Or get search suggestion and latest updates.


Tagged: