Wrong page redirect with servlet

0

I have the following method for logging users into the system:

public void logarUsuario(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException{
    try{
        String email = request.getParameter("email_login");
        String senha = request.getParameter("senha_login");

        EntityManagerFactory emf = Persistence.createEntityManagerFactory("PROJETO_POSTPU");
        UserJpaController userJpa = new UserJpaController(emf);
        RoleJpaController roleJpa = new RoleJpaController(emf);

        List<User> listUser = new ArrayList();
        listUser = userJpa.findUserEntities();

        String result = "";
        for(User u : listUser){
            if(userJpa.findUser(u.getIduser()).getEmail().equals(email) && userJpa.findUser(u.getIduser()).getPassword().equals(senha)){
                result = "Logado com sucesso!";
                break;
            } else {
                result = "Email ou senha inválido!";
                request.setAttribute("resp", result);
                request.getRequestDispatcher("/formulario.jsp").forward(request, response);
            }
        }

        request.setAttribute("resp", result);
        request.getRequestDispatcher("/feed/feed.jsp").forward(request, response);

    } catch(Exception e) {
        e.printStackTrace();
    }
}

The method works perfectly, the only problem is that it redirects to a page containing the servlet name ( link ), the If you do not know what to do, you will not be able to see the URL of the page. ( link )

It also seems to generate an error but I do not know, the application does not stop, it still works normally.

  

01-Nov-2018 17: 56: 05.038 INFORMATION [Abandoned connection cleanup thread] org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading Illegal access: this web application instance has been stopped already. Could not load []. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.    java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load []. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.   [EL Info]: connection: 2018-11-01 17: 56: 05.04 - ServerSession (1286306687) - file: / Users / alissonfernando / NetBeansProjects / PROJECT_POST / build / web / WEB-INF / classes / _PROJECT_POSTPU successful logout       at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading (WebappClassLoaderBase.java:1329)       at org.apache.catalina.loader.WebappClassLoaderBase.getResource (WebappClassLoaderBase.java:1004)       at com.mysql.jdbc.AbandonedConnectionCleanupThread.checkContextClassLoaders (AbandonedConnectionCleanupThread.java:90)       at com.mysql.jdbc.AbandonedConnectionCleanupThread.run (AbandonedConnectionCleanupThread.java:63)       at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)       at java.util.concurrent.ThreadPoolExecutor $ Worker.run (ThreadPoolExecutor.java:624)       at java.lang.Thread.run (Thread.java:748)

    
asked by anonymous 01.11.2018 / 23:49

0 answers