Srinivas Reddy
Srinivas Reddy

Reputation: 629

java/jsf redirect page

when i opend my login page and i have connected with my email and password and when i diconnected page i am going to login page its gud upto here and when i press back button in the browser i am going to main page again.

I have deleted sessions by using session.invalidate(),but iam not able to rediect the page to login.

Upvotes: 0

Views: 681

Answers (2)

Nishant
Nishant

Reputation: 55856

Back Button brings HTML pages from browser cache. You do not have a control over it. But make sure that your authentication management does not let use the functionality that requires authenticated user.

You may, however set "no-cache" is header. But, I strongly discourage it. see how:

response.setHeader("Cache-Control","no-cache");

Upvotes: 0

Jigar Joshi
Jigar Joshi

Reputation: 240860

It is because your page is cached.

Create a filter that will set following headers to the response

HttpServletResponse hsr = (HttpServletResponse) response;
hsr.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1.
hsr.setHeader("Pragma", "no-cache"); // HTTP 1.0.
hsr.setDateHeader("Expires", 0); // Proxies.
chain.doFilter(request, response);

Upvotes: 1

Related Questions