我在eclipse和webapps文件夹中有一个web动态项目index.html,我可以通过以下方式访问它:
http://localhost:8080/javaTest我想通过以下方式访问我的应用程序:
http://localhost:8080我尝试通过右键单击项目->属性->Web项目设置将上下文根更改为"/“,但在http://localhost:8080/上找不到请求的资源,并且应用程序仍然在http://localhost:8080/javaTest上运行。
这是我的web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>javaTest</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>编辑: server - tomcat 7.0.34
发布于 2013-08-13 12:06:38
在tomcat的wiki中使用此方法
http://wiki.apache.org/tomcat/HowTo#How_do_I_make_my_web_application_be_the_Tomcat_default_application.3F
发布于 2013-10-07 21:06:47
发布于 2016-09-14 18:41:36
如果要从URL中删除应用程序名称或项目名称,请在tomcat服务器文件conf/server.xml文件中更改jsut。
appBase="webapps“
删除"webapps“,只使用"/”
appBase="/“
现在,您可以检查http://localhost:8080
https://stackoverflow.com/questions/18111028
复制相似问题