I have been readin Head First JSP and Servlet, I see that the web.xml
has
<!-- To name the servlet -->
<servlet>
<servlet-name>ServletName</servlet-name>
<servlet-class>packy.FirstServlet</servlet-class>
</servlet>
<!-- For URL's to map to the correct servlet -->
<servlet-mapping>
<servlet-name>ServletName</servlet-name>
<url-pattern>/ServletURL</url-pattern>
</servlet-mapping>
Why hide the original servlet's location ? I can simply see that it is for security reason and some more such kinda advantages, but why have a name for each servlet ? Why can't the web.xml
be simple like
<servlet>
<url-pattern>ServletURL</url-pattern>
<servlet-class>packy.FirstServlet</servlet-class>
</servlet>
See Question&Answers more detail:os