如何从Tomcat root获取欢迎页面,而不是webapp上下文? [英] How to get a welcome page from Tomcat root, rather than webapp context?

查看:184
本文介绍了如何从Tomcat root获取欢迎页面,而不是webapp上下文?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Tomcat 7中,当我访问localhost:8080 /时,我想要我的欢迎页面(index.html)加载。现在,我必须去webapp上下文localhost:8080 / MyWebApp。

In Tomcat 7, I want my welcome page (index.html) to load when I access localhost:8080/. Right now, I have to go to the webapp context, localhost:8080/MyWebApp.

Tomcat中是否有一个文件夹放置不是webapp的一部分的页面?我很困惑这是如何工作的...

Is there a folder in Tomcat to place pages that are not part of a webapp? I'm confused how this works...

编辑:我注意到,Eclipse中的Server的web.xml有一个名为default的servlet,它被映射到/...我想知道我是否必须改变这些东西?

I notice that the web.xml for the Server in Eclipse has a servlet called "default" which is mapped to "/"... I wonder if I have to change something here?

EDIT2:我发现这个: http://wiki.apache.org/tomcat/HowTo#How_do_I_override_the_default_home_page_loaded_by_Tomcat.3F

I found this: http://wiki.apache.org/tomcat/HowTo#How_do_I_override_the_default_home_page_loaded_by_Tomcat.3F

但是,我的ROOT文件夹中已经有一个index.html,并且仍然从根URL获取404。如果我启动服务器而不使用Eclipse,它可以工作。这里发生了什么?当您通过它启动服务器时,Eclipse究竟做了什么?很明显,它不是复制我的安装的ROOT文件夹。

But, I already have an index.html in my ROOT folder, and still getting 404 from the root URL. If I start the server without using Eclipse, it works. What's going on here? What exactly does Eclipse do when you start the server through it? Obviously it's not reproducing the ROOT folder of my installation.

推荐答案

已解决!
http://wiki.eclipse.org/WTP_Tomcat_FAQ#If_I_start_my_Tomcat_server_and_try_to_display_Tomcat.27s_default_page .2C_why_do_I_see_a_directory_listing_or_404_error_page.3F

这篇关于如何从Tomcat root获取欢迎页面,而不是webapp上下文?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆