UT010019: Response already commited

562 views
Skip to first unread message

Cezar Apulchro

unread,
Nov 7, 2023, 5:14:46 AM11/7/23
to WildFly
Hi, I've a servlet that get parameters of JSP login page to check if the user is valid, the return of this check is a cod that say what others JSP pages this user can access, then with this cod I call the page using the "RequestDispacher - with method forward" but I am receiving this error then I changed to "response.sendRedirect" and I received the same error, I use "itcmedbr/Frame_Usuario_W01.jsp" in Dispatcher and Redirect to load on browser.
Does anyone know how to solve it?

Bartosz Baranowski

unread,
Nov 7, 2023, 6:00:41 AM11/7/23
to WildFly
Hey. Simple reproducer in such case would be worth gold bar or two. Otherwise hard to give any meaningful advice.
Also, what is "cod" ?

Cezar Apulchro

unread,
Nov 7, 2023, 6:27:02 AM11/7/23
to WildFly
Hi, "cod" is a collumn of mysql  table  in this case "3" is returned from access method of mysql.
"

if (tipo.trim().equals("3"))

{

response.sendRedirect("itcmedbr/Frame_Usuario_W01.jsp");

}

"
Thanks.

Cezar Apulchro

unread,
Nov 7, 2023, 6:04:52 PM11/7/23
to WildFly
My environment:
- Java 20
- WildFly 27.0 Server
- Maven 4.0.0:
  - jakarta.jakartaee-web-api
I am really nedding help.

Richard Opalka

unread,
Nov 8, 2023, 5:52:20 AM11/8/23
to Cezar Apulchro, WildFly
Did you try WildFly 30 ?

Rio

--
You received this message because you are subscribed to the Google Groups "WildFly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wildfly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wildfly/089b1e43-3b0c-49eb-baf4-4994e2a7a1a7n%40googlegroups.com.

Cezar Apulchro

unread,
Nov 8, 2023, 1:17:08 PM11/8/23
to WildFly
Why wildfly 30? I don't believe that until WildFly 29 nobody have used "RequestDispatcher".

Cezar Apulchro

unread,
Nov 20, 2023, 5:20:20 AM11/20/23
to WildFly
After remove this lines from my servlet the problem was solved, wrong place of this lines.
Lines removed:
"

        response.setContentType("text/html");
        PrintWriter out = response.getWriter();
        out.println("<!DOCTYPE html>");
        out.println("<html>");
        out.println("<head>");
        out.println("<title>Servlet NewServlet</title>");            
        out.println("</head>");
        out.println("<body>");
out.println("<br>");
out.println("<h1> Parametros enviados:</h1");
        out.println("<br>");
        out.println("<h1>Nome: " + Nome + " - Senha: " + Senha + " - CNPJ: " + CNPJ + "</h1>");
        out.println("</body>");
        out.println("</html>");
        out.close();
"
Thanks guys.
Reply all
Reply to author
Forward
0 new messages