简体   繁体   中英

I am using struts freamwork, after log out when i pressed browser back button it is going to last opened page. How to send it to log in page?

I am using struts framework, after log out when i pressed browser back button it is going to last opened page. How to send it to log in page?

Actually i want solution in java not in javascript.

I believe you must be having a security filter to intercept all incoming requests. If not you need to have one to authenticate user session. Here on failure you can forward to login page.

Also check if the page is rendered from browser cache. If so you can set no-cache in the header of the JSP.

<%
   response.setHeader( "Pragma", "no-cache" );
   response.setHeader( "Cache-Control", "no-cache" );
   response.setDateHeader( "Expires", 0 );
%>

If you have invalidated ( session.invalidate(); ) your session through logout, just in action control you forward your request to the jsp page you want. Once session is broken if you press back it won't go to the same page I think.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM