Hi All , I have a simple JSP application wherein I have all pages are displayed using JSP's and all business logic is contained in Java Beans. In order to manage sessions in this application, I am including the following piece of code in every JSP page :-
<%@ page session = "false"%> <% HttpSession session = request.getSession(false); if(session == null){ response.sendRedirect("login.jsp?message=NoSession"); return; } %> This seems to be working fine. But problem arises when I try to use a bean with session scope, wherein an Exception is thrown, since we are trying to use a session scope in a page with session set to false. A work around could be to have the session directive as true , add some variable to the session when it is first created, and then subsequently check for this variable in every page. I would like to know : 1) Is the above work around correct and robust enough? 2) Is there a better approach for managing sessions in such an application? Thanks Sudhanshu ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html