Java Sevlet Mapping.欢迎文件列表
发布时间:2020-05-28 20:16:55 所属栏目:Java 来源:互联网
导读:在我的web.xml文件中,我有这个 !-- WELCOME FILE LIST --welcome-file-list welcome-file/index/welcome-file/welcome-file-list 哪个映射到此 !-- SERVLET FOR THE HOME PAGE --servlet servlet-nameHom
|
在我的web.xml文件中,我有这个 <!-- WELCOME FILE LIST -->
<welcome-file-list>
<welcome-file>/index</welcome-file>
</welcome-file-list>
哪个映射到此 <!-- 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>
当我把它放在地址栏中时,我得到了我的主页站点,servlet根据请求抓取了我的所有内容. http://localhost:8086/gmustudent/index 但是,这给了我一个404 http://localhost:8086/gmustudent/ 当没有明确说明索引时,为什么我的欢迎文件列表不会抓取欢迎文件servlet? 解决方法http://localhost:8086/gmustudent/ gmustudent是web应用程序的上下文根. index是您想要访问的资源. 你配置如下所示的欢迎文件,删除前置/: <welcome-file>Index</welcome-file> </welcome-file-list> 访问 http://localhost:8086/gmustudent/ (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
