[英]Java Sevlet Mapping. Welcome File List
In my web.xml file I have this 在我的web.xml文件中,我有这个
<!-- WELCOME FILE LIST -->
<welcome-file-list>
<welcome-file>/index</welcome-file>
</welcome-file-list>
Which maps 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 this in the address bar I get my home page site and the servlet grabs all of my content as requested. 当我把它放在地址栏中时,我得到了我的主页站点,servlet根据请求抓取了我的所有内容。
http://localhost:8086/gmustudent/index
However, this gives me a 404 但是,这给了我一个404
http://localhost:8086/gmustudent/
Why isn't my welcome file list grabbing that welcome file servlet when index is not explicitly stated? 当没有明确说明索引时,为什么我的欢迎文件列表不会抓取欢迎文件servlet?
http://localhost:8086/gmustudent/
gmustudent is the context root of your webapplication. gmustudent是web应用程序的上下文根。 index is the
resource
you wanna access. index是您想要访问的
resource
。
you configure welcome file like below, remove the prepending / : 你配置如下所示的欢迎文件,删除前置/:
<welcome-file>Index</welcome-file>
</welcome-file-list>
to access 访问
http://localhost:8086/gmustudent/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.