web.xml里面的welcome-file-list是什么意思
2014-11-29 23:39
501 查看
为了解决在eclipse打开工程里面随意一个网页都能正常显示时,写过的页面都要加进web.xml的welcome-file-list里面,例如
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>buy31-35.html</welcome-file>
<welcome-file>favorite.html</welcome-file>
<welcome-file>MyFavorite.html</welcome-file>
<welcome-file>payFail.html</welcome-file>
<welcome-file>PayIt.htm</welcome-file>
<welcome-file>paysucess.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
表示里面含有index.jsp、buy31-35.html等页面,运行工程时默认显示顺序第一的页面,在这里面也就是index.jsp页面。
如果:
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
里面没有把buy31-35.html加进去,即使工程里面含有这个页面,运行此页面时也是不能打开的,打开的只能是默认的index.jsp页面。
另外 index.jsp我们一般都是删掉,重新新建自己的html或者是jsp等页面,这里index.jsp其实有一个作用,index.jsp页面是和WebRoot同级的,我们新建页面时一般习惯也和WebRoot同级,其实这样不安全,这样容易被人家发现源代码,为了保护源代码,可以把自己写的页面放进Web-INF下,意思页面的信息,是不允许别人看到的。这样在index.jsp里的body还要加一个设置<jsp:forward page="buy31-35.html"></jsp:forward>意思是index.jsp跳转到自己写的buy31-35.html页面。
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>buy31-35.html</welcome-file>
<welcome-file>favorite.html</welcome-file>
<welcome-file>MyFavorite.html</welcome-file>
<welcome-file>payFail.html</welcome-file>
<welcome-file>PayIt.htm</welcome-file>
<welcome-file>paysucess.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
表示里面含有index.jsp、buy31-35.html等页面,运行工程时默认显示顺序第一的页面,在这里面也就是index.jsp页面。
如果:
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
里面没有把buy31-35.html加进去,即使工程里面含有这个页面,运行此页面时也是不能打开的,打开的只能是默认的index.jsp页面。
另外 index.jsp我们一般都是删掉,重新新建自己的html或者是jsp等页面,这里index.jsp其实有一个作用,index.jsp页面是和WebRoot同级的,我们新建页面时一般习惯也和WebRoot同级,其实这样不安全,这样容易被人家发现源代码,为了保护源代码,可以把自己写的页面放进Web-INF下,意思页面的信息,是不允许别人看到的。这样在index.jsp里的body还要加一个设置<jsp:forward page="buy31-35.html"></jsp:forward>意思是index.jsp跳转到自己写的buy31-35.html页面。
相关文章推荐
- web.xml之welcome-file-list、error-page
- 关于web.xml中的<welcome-file-list>中的默认首页文件
- 关于web.xml中的welcome-file-list(欢迎页)
- web.xml中的welcome-file-list不起作用
- web.xml(7)_mime-mapping、welcome-file-list、error-page
- 关于web.xml中的welcome-file-list(欢迎页)
- 【XML】web.xml中welcome-file-list的作用
- java web.xml welcome-file-list的默认值
- java web.xml welcome-file-list的默认值
- Jetty下web.xml的welcome-file-list无效
- web.xml中的welcome-file-list
- java web.xml welcome-file-list的默认值
- web.xml(7)_mime-mapping、welcome-file-list、error-page
- web project 中利用 web.xml 中的 默认welcome-file-list 做跳转
- web.xml中的welcome-file-list不起作用
- 关于web.xml中<welcome-file-list>
- 关于web.xml中的<welcome-file-list>中的默认首页文件
- web.xml中的welcome-file-list(欢迎页)
- 关于web.xml中的<welcome-file-list>中的默认首页资料
- 在web.xml中的welcome-file指定动态地址