2 Replies Latest reply on Jun 5, 2013 1:13 AM by Panasaki

    Form, Servlet and repopulate form in case of error

    Panasaki Level 1

      Good morning,


      I come to ask for help in this case where I am block.


      I have an html form calling a servlet, if the servlet find an internal error or a validation error returns to the form and the form repopulate the values.


      My problem is I am coming back to the form with a forward like that:


              final SlingHttpServletRequest req = new SlingHttpServletRequestWrapper(request) {


                   public String getMethod() {

                                                               return "GET";




                        final RequestDispatcher dispatcher = req.getRequestDispatcher("URLofTheForm");

                                 dispatcher.forward(req, response);


      and in that way in the browser appears the path of the servlet where the form called and is not viable to me. Is there a way to achieve the same but in the browser appears the correct url where the form is?


      Probably exist another way to achieve this behaviour, but I do not know.


      Thank you for the help.