Response.sendRedirect and HTML Frame

zhaozj2021-02-16  55

It's too busy recently, a bunch of messy things, even blogs don't have time to play. Take the weekend, I will communicate with you yesterday.

It is currently doing a web project that uses HTML Frame in which HTML Frame is used. Mainly in order to solve local refresh. But there is one of the interesting questions. In order to prevent unregistered users from using a filter in the app, it is used to determine if the user is logged in, and if not turned to the login page. It turned out to be repositioned using Response's SendRedirect, but because of the use of frame, the actual request is sent in the page included in the Frame when the request is sent to the background. In this way, the login page originally set alone is included in this frame, completely and expected! !

If you are in the HTML page, such problems can be solved by linking Target properties, but there is no place to specify target Target in Response. How to solve it? One way is to do a JSP, use JS to redirect link to the real login page, and we can have the opportunity to use the target properties. Then direction to this JSP in the FILTER. However, such a page of this page gives people feel uncomfortable. But this is inspired that we can do this, please see the code: java.io.printwriter out = response.getwriter (); out.println (""); out.println ("