传说中的北京呢?
---xingyunpi
jsp web project中,一般情况下,在WEB-INF中可以配置默认的访问文件名称,一般情况下是index.html.
遇到的问题:
首先,在TOMCATHOME/conf/server.xml中配置了一个虚拟目录 admin.sorina ,指向项目中某个文件夹,比如:test(项目名称)/webmaster/admin/,这个时候,在访问admin.sorina/的时候,就会访问admin下的index.html,但是,按照这种思路,我在WEB-INF中配置了一个welcome-file,指定访问list_1_1.html,但是,用相对路径访问,如访问:admin.sorina/login/的时候,我的目的相当于访问test(项目名称)/webmaster/admin/login/list_1_1.html,但是,这个时候却是出现404错误.
解决的办法:
好像是用这种相对路径访问的方式来配置welcome-file是不通的,要在在TOMCATHOME/conf/web.xml中进行同样的配置,默认为:
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
改为:
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>list_1_1.html</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
同时在
WEB-INF/web.xml中进行对应配置:
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>list_1_1.html</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
这样,就能正常访问了.