This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
The documentation of encodeURL doesn't say that it will add the context path to the passed path. The encodeURL is used for session tracking when Cookies are disabled. It adds the JSESSIONID to the end of the request path. You'll have to use request.getContextPath to add the context path to your link...
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.
You can also use taglibrary
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:url value="/PriceRangeServlet" />
which add context path to the url and add jsessionid if it is needed