Problem to return to jsp by changing url using sendRedirect in servlet

0

I log in to my jsp, then I command the servlet to do the checks, and return to jsp, but when I return the url it continues with the path of the servlet, not with my index.jsp, it follows part of the code which return to my jsp.

    try {
        System.out.println("esta no ServletLogin");
        loginUsuario = new UsuarioService().verificaLoginUsuario(emailUsuario);
        if(loginUsuario == true){
            loginSenhaUsuario = new UsuarioService().verificaSenhaUsuario(emailUsuario, senhaUsuario);
             if(loginSenhaUsuario == true){
                 usuario = new UsuarioService().getUsuario(emailUsuario);
                 request.getSession().setAttribute("emailUsuario", emailUsuario);
                 request.getSession().setAttribute("nomeUsuario", usuario.getNome());;
                 System.out.println("anteslogado");
                 response.sendRedirect("index.jsp");
                 System.out.println("logado");

             }else{
                   System.out.println("senha diferente");
             }

        }else{
               System.out.println("nao existe esse usuario");
        }
    } catch (ClassNotFoundException | SQLException e) {
        System.out.println("não deu pra verificar");
    }

}
    
asked by anonymous 24.03.2017 / 18:10

0 answers