Java Sevlet Mapping. Welcome file list
•
Java
On my web In the XML file, I have this
<!-- WELCOME FILE LIST --> <welcome-file-list> <welcome-file>/index</welcome-file> </welcome-file-list>
Which map to 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 it in the address bar, I get my home site, and the servlet grabs all my content on request
http://localhost:8086/gmustudent/index
But it gave me a 404
http://localhost:8086/gmustudent/
Why doesn't my welcome file list grab the welcome file servlet when the index is not specified?
Solution
http://localhost:8086/gmustudent/
http://localhost:8086/gmustudent/
Gmustudent is the context root of a web application Index is the resource you want to access
You can configure the following welcome file and delete the pre - /:
<welcome-file>Index</welcome-file> </welcome-file-list>
visit
http://localhost:8086/gmustudent/
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码