How do I map a JSP using web.xml and RequestDispatcher?
Created Nov 19, 2002
Abhinav Srivastava It is not mandatory for JSPs to be registered in the web.xml but it is sometimes done; the <servlet-class> tag being replaced by the <jsp-file> tag (and others remaining the same).
Now when you want to forward to a servlet that doesn't have a url-mapping in the web.xml, you use
getNamedDispathcer(servlet-name) else it should be the url-pattern when you are using getRequestDispatcher(path).
e.g <jsp-file>/index.jsp</jsp-file>
And thus you can give a JSP an alias.
This is what I have understood of it. The more hazy part is that even JSPs are compiled into servlets at runtime. But these servlets are accessible without specifying any url-pattern.