if (session != null) { if (session.getAttribute("id") != null) { int id = (Integer) session.getAttribute("id"); } else { response.sendRedirect("membersadmin"); } }