How to avoid session creation on display of Login page ?
posted 3 years ago
I have developed a login page in struts 1.3 ,onclick of Login ,action class is invoked &where we check for valid user ,if user is valid ,session has to be created ,but on display of Login.jsp page session is getting created automatically even before checking whether user is authenticated or not.
Why would you not want to create a session? In general it's not the presence/lack of session that indicates login, but rather a valid user/etc. object in the session.
To answer your specific question, prevent session creation in the JSP with:
In general, you don't want to access a JSP page directly in an MVC app, rather go through an action. IIRC the default request processor will create a session for you, providing another reason to re-think your approach.