What's the difference in putting a "slash" at the end to make a URL?
What is the difference between the two urls:
http://localhost:8084/D_Nappster/NewServlet/
and
http://localhost:8084/D_Nappster/NewServlet
The first url gets the response 404
and the second one works as expected.
From web.xml:
<servlet-mapping>
<servlet-name>NewServlet</servlet-name>
<url-pattern>/NewServlet</url-pattern>
</servlet-mapping>
+3
source to share
3 answers
Usually the a /
at the end makes the server assume it's a folder and not the servlet mentioned in the sample url.
http://localhost:8084/D_Nappster/NewServlet/
So in this case, it tries to find the default page for the NewServlet folder. Whereas, in the second url, the server correctly infers that it is servlets and renders the UI fine.
In addition, web.xml does not contain a definition for the NewServlet/
url template and hence 404 errors.
0
source to share