java - redirect page to login page on session time out in spring mvc without using spring security -


It is easy to do this with spring security but what if I am not using Spring Security and in Spring MVC " The session expired "message with the user want to redirect the user to login.

Is this a specific method of spring?

Yes, you can use the following snippet. Try to include this line in the header of the page, change user attribute according to user session object.

  Http session session = request.getSession ("user"); If (session! = Null & amp;; session.isNew ()) {// do something here} and {response.sendRedirect ("/ redirect_the_page.jsp"); }    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -