Redirect JSP page

Asked

Viewed 391 times

0

When registering the "object" in a JSP, it calls a command that at the end calls another that redirects to the "list".

    RequestDispatcher dispatcher = request.getRequestDispatcher("/controller.do?command=ListarOperacoes");
    dispatcher.forward(request, response);

But when it returns to the JSP where it lists the "objects", in the URL this is the parameters of the created "object". And if I give an F5 (update) page, it makes the registration again.

I need to reset the URL when redirecting to the JSP to list.

RequestDispatcher dispatcher = request.getRequestDispatcher("/pages/cadastro/Operacoes.jsp");
  • I think you should not run a forward but a redirect. So, replace it with forward response.sendRedirect("/url de destino");

  • Thank you very much, it worked ;D

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.