It's my first day trying servlets. It's just a simple login function, but I get an error that doesn't explain what I'm doing wrong. It just says
404: The requested resource is not available.
Here's my servlet:
public class Login extends HttpServlet {
    private static final long serialVersionUID = 1L;
    public Login() {
        super();
    }
    protected void doGet(HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
        HttpSession session = request.getSession();
        String key = "ole";
        String username = request.getParameter("username");
        String password = request.getParameter("password");
        response.sendRedirect("NewFile.jsp");
        if (session.getAttribute(username).equals(key)
                && session.getAttribute(password).equals(key)) {
            response.sendRedirect("secret.jsp");
        } else {
            response.sendRedirect("NewFile.jsp");
        }
    }
    protected void doPost(HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
    }
}
And here's my login page:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Login page</title>
</head>
<body>
    Enter username and password below.
    <form method=get action="hej">
        <input type="text" user="username" /> <input type="password"
            user="password" /> <input type="submit" value="Login" />
    </form>
</body>
</html>
There is a file called secret.jsp as well, but there's nothing interesting in there. I don't understand why it's returning 404. When I have remove the if statement it works... only then, there's not much function.
 
     
     
    