Display Java Sevlet. Welcome File List

In my web.xml file, I have this

<!-- WELCOME FILE LIST --> <welcome-file-list> <welcome-file>/index</welcome-file> </welcome-file-list> 

What matches this

 <!-- SERVLET FOR THE HOME PAGE --> <servlet> <servlet-name>HomePageServlet</servlet-name> <servlet-class>com.gmustudent.HomePageServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>HomePageServlet</servlet-name> <url-pattern>/index</url-pattern> </servlet-mapping> 

When I put this in the address bar, I get my homepage site, and the servlet captures all my content upon request.

 http://localhost:8086/gmustudent/index 

However it gives me 404

 http://localhost:8086/gmustudent/ 

Why doesn't my welcome file list capture this welcome file servlet when the index is not explicitly specified?

+6
source share
1 answer
  http://localhost:8086/gmustudent/ 

gmustudent is the context root of your web application. index is the resource you want to get.

you configure the welcome file as shown below, remove the extra /:

 <welcome-file>Index</welcome-file> </welcome-file-list> 

to access

  http://localhost:8086/gmustudent/ 
+18
source

All Articles