Hi,
In my
Servlet, I used below code,
out.println("<html><body");
out.println("<a href=\""+response.encodeURL("/PriceRangeServlet")+ "\"> Click me </a>");
out.println("</body></html>");
In response, when I click on Click me link, I am getting HTTP Status 404 - /PriceRangeServlet because of it is ignoring context path of my application. And in URL, it's shown as
http://localhost:8080/PriceRangeServlet
instead of
http://localhost:8080/testweb/PriceRangeServlet. Here, testweb is my application name(context name).
Why it is Ignoring context name. If I used RequestDispatcher in Servlet, it is working fine.
What is the difference between these two. And how I fix the above Issue.
Thanks,
Siva