session expire(not exist)
hi,
here is my code:
public void doGet (HttpServletRequest _req, HttpServletResponse _res)
throws ServletException, IOException {
/* Refresh session attributes */
session = _req.getSession();
session.removeAttribute("loginError");
session.removeAttribute("submitError");
String action_get = _req.getParameter("action_get");
String rachunek = _req.getParameter("rachunek");
String bc = _req.getParameter("bc");
// log off user
if (action_get.equals("logout")) {
loginError_logout(_req, _res);
}
else if (action_get.equals("showReport")) {
/* Make sure the user has logged in before recording the data */
String validUser = (String) session.getAttribute("validUser");
if (validUser.equals("y")) {
gotoPage("showReport.jsp", _req, _res);
} else { /* If the user did not login, then send them to the login page */
loginError(_req, _res);
}
}
I have problem: at JSP/servlet page i have a few links, after about 30 minutes without any action the session not exist, and when user click at some link then have error: (HTTP Status 500-The server encountered an internal error () that prevented it from fulfilling this request.): java.lang.NullPointerException at line:
if (validUser.equals("y")) {
i try to put this above the error line:
if (session == null) {
gotoPage("index.jsp", _req, _res);
}
but this is still problem
thanks if anyone can help

