问题描述
我刚刚开始了解 Web 应用程序并将它们部署到 Tomcat.所以我从一个示例 Web 应用程序项目开始——由 struts、hibernate 等组成.
ANT 构建成功.此外,能够通过 Catalina/host 下的 xml 部署 Web 应用程序.我可以毫无问题地打开网站.
这是我的网络应用程序的结构
-爆炸-WEB-INF-类-lib-web.xml-index.jsp-welcome.html
我的问题是
Tomcat 如何知道它应该打开的第一页/起始页/主页是什么?这是在哪个文件中指定的?
在任何 Web 应用程序中,WEB-INF/
文件夹中都会有一个 web.xml
.
如果您的网络应用程序中没有一个,就像您的文件夹结构中的情况一样,默认的 Tomcat web.xml
位于 下TOMCAT_HOME/conf/web.xml
不管怎样,web.xml的相关行是
<welcome-file>index.html</welcome-file><welcome-file>index.htm</welcome-file><welcome-file>index.jsp</welcome-file></welcome-file-list>
因此,找到匹配此模式的任何文件都将显示为主页.
在 Tomcat 中,Web 应用程序中的 web.xml 设置将覆盖默认设置(如果存在).
进一步阅读
I am just getting started to learn about Web Apps and deploying them to Tomcat. So I started with a sample web app project - made up of struts, hibernate, etc., etc.
The ANT build was successful. Also, was able to deploy the web app through an xml under Catalina/host. I am able to open the web site with no issues.
This is the structure of my web app
My question is
How does Tomcat know which is the first page / starting page / home page that it is supposed to open? Which file is this specified in?
In any web application, there will be a web.xml
in the WEB-INF/
folder.
If you dont have one in your web app, as it seems to be the case in your folder structure, the default Tomcat web.xml
is under TOMCAT_HOME/conf/web.xml
Either way, the relevant lines of the web.xml are
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
so any file matching this pattern when found will be shown as the home page.
In Tomcat, a web.xml setting within your web app will override the default, if present.
Further Reading
How do I override the default home page loaded by Tomcat?
这篇关于Tomcat 如何找到我的 Web 应用程序的主页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!