Java examples for Servlet JSP:Servlet
Helper function to check for the session
import java.io.File; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; public class Main{ /**/*from w w w .j a v a2 s . co m*/ * Helper function to check for the session * @param req * @return */ public static boolean isReqInSession(HttpServletRequest req) { boolean isReqInSession = false; HttpSession session = req.getSession(false); if (session == null) { return isReqInSession; } Integer accountantId = (Integer) session .getAttribute("accountantid"); if (accountantId == null) { return isReqInSession; } isReqInSession = true; return isReqInSession; } }