You just need to pass the servlet-mapping
url-pattern
to getRequestDispatcher
.
Let's say your servlet mapping is "myMap" for the "MapOut" servlet in web.xml
. Then he must be
RequestDispatcher dispatcher = request.getRequestDispatcher("/myMap"); dispatcher.forward(request,response);
doGet()
redirected servlet will be called.
Example: web.xml
<servlet> <description></description> <servlet-name>MapOut</servlet-name> <servlet-class>coreservlets.MapOut</servlet-class> </servlet> <servlet-mapping> <servlet-name>MapOut</servlet-name> <url-pattern>/myMap</url-pattern> </servlet-mapping>
source share