views:

43

answers:

2

I implemented a sevlet filter in my application, and within the filter, if I find some specific url pattern, I will use request.getSession().invalidate() to logout and clear the session, then redirect to a login page.

session.invalidate();
session.setAttribute("hi", true);
response.sendRedirect("login.jsp");

but I found, after that I enter username and password, then submit the login form, the previous session seems not be completely cleared.

So is it possible to let me completely clear out the session and just like start a new IE instance ?(BTY, my code works in FF and Chrome).

+1  A: 

The session is a server-side concept. The browser only hold a jsessionid to tell the server which session object to fetch for this request.

That said, your problem is not IE. And even if it is, it is some sort of caching the you are facing. Clear your cache. You can set these response headers:

Cache-Control: no-cache, no-store
Pragma: no-cache
Bozho
I know this too, but the problem is I can not clear the cache at server side.
MemoryLeak
I meant client-side cache
Bozho
yeah, it's client side cache, I can not clear client-side cache at server side, and it's ridiculous to ask the user to clear the cache after logout, right ?
MemoryLeak
you can send headers that instruct the browser not to cache. See updated
Bozho
I tried, but not work ... Could you please have a look at my comment under my question , that is the more specific problem.
MemoryLeak
A: 

@Bozho a quick question to clarify. JSP has default session implict object created. Here in this case ,he created a session and then invalidates , after invalidation , he sets the attributes which again uses implicit session created.

Suresh S