Hi all,
I'm developing a login servlet but have a recurring problem with the RequestDispatcher throwing up a NullPointerException. I call the RequestDispatcher using this method:
RequestDispatcher dispatcher = null;
if (dbpass.equals(password))
{
session = request.getSession(true);
session.setAttribute("user",uID);
session.setAttribute("dept",uDept);
dispatcher = getServletContext().getRequestDispatcher("/index.html");
}
else
{
dispatcher = getServletContext().getRequestDispatcher("/loginjsp.jsp");
}
dispatcher.forward(request, response);
The layout of the directory is:
WEBAPP
---- index.html
---- loginjsp.jsp
|
----WEB-INF
The servlet is mapped as though it were in the root webapp directory. What I've read on here suggests to me the problem lies in the path I'm giving the RequestDispatcher, but I've tried almost all the other possible paths I can think of and still get the exception error.
Any thoughts would be appreciated!