Implementing login functionality with Servlets, jsp and javascript