0

When I use getRequestDispatcher(url).forward(request,response) the url changes to the Servlet and not to the original, why?

For example: (Current url: http://localhost:8080/ProjectX/index.jsp)

<form action="/ServletX">...</form>

When I do: getRequestDispatcher("index.jsp").forward(request,response)

In the browser the URL is http://localhost:8080/ProjectX/ServletX

Why that? It's good or has an error?

(I think the url maybe the same before the form was submitted index.jsp)

Thanks,

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • when you submit the form , the url will be `http://localhost:8080/ProjectX/ServletX`, – Ramanlfc Mar 13 '16 at 01:14
  • bcoz your form has `action="/ServletX"` , so when you submit the form it will send data to whatever you specified in `action` – Ramanlfc Mar 13 '16 at 01:17

0 Answers0