This is the question in withmilk.com,
Given:
<servlet-mapping>
<servlet-name>tempServlet</servlet-name>
<url-pattern>temp.jsp</url-pattern>
</servlet-mapping>
File 'temp.jsp' is in the myApp root.
Identify true statement when the url for tempServlet is typed in the location bar of a browser e.g.:
http://127.0.0.1:8080/myApp/servlet/myPackage.tempServlet A <servlet-name> should be the parent tag of
<servlet-mapping>
B Contents of temp.jsp from the myApp root is
displayed on the screen
C '
servlet' should be 'Servlet' in the URL -
capital 'S'
D Error is generated
The explanation given was,
D is true. A is false as it is fine the way it is mapped.
Error is generated. The url-pattern should have a preceding forward slash: /temp.jsp to be succesful. And the idea is that when temp.jsp is called - tempServlet is displayed, not the other way around.
But,
i have not seen in the specification nor in deshmukh book saying that url-pattern must have a forward slash. Please explain this to me.
Thanks