简体   繁体   English

如何从Eclipse网址中删除项目名称?

[英]How to Remove Project name from eclipse url?

Basically I want to remove project name while I access my project in eclipse. 基本上,我想在eclipse中访问项目时删除项目名称。

so currently when I want to access a link of my web-app I have to put it as localhost:8080/project_name/blah_blah_blah But I want it accessible by just localhost:8080/blah_blah_blah or say The project itself should be accessible by just localhost:8080 . 所以目前,当我要访问我的Web应用程序的链接时,必须将其设置为localhost:8080/project_name/blah_blah_blah但我希望仅通过localhost:8080/blah_blah_blah可以访问它,或者说项目本身应该仅可以通过localhost:8080访问localhost:8080

Through googling I found this URL issue with tomcat include project name but in my case my context root is as / by default. 通过谷歌搜索,我发现此tomcat包含项目名称的URL问题,但在我的情况下,默认情况下,我的上下文根为/

Project Context root Options 项目上下文根选项

FYI: This is the only project I have in my Eclipse 仅供参考:这是我在Eclipse中拥有的唯一项目

For people who come across this problem too. 对于也遇到这个问题的人。

To explain deeply: First remember that eclipse uses server under eclipse project explorer within its all configuration. 深入解释:首先,请记住eclipse在其所有配置中都使用eclipse project explorer下的服务器。

In order for you change your project path to something different, what you can do is to open server.xml under Project Explorer -> Servers -> Tomcat vX.X ... -> server.xml . 为了让您更改为不同项目的路径,你可以做的就是打开server.xml下的Project Explorer -> Servers -> Tomcat vX.X ... -> server.xml

At the bottom of this file You should see this line Before End of </host Tag: 在此文件的底部,您应该在</host标记结束之前看到以下行:

<Context docBase="Duck" path="/Duck" reloadable="true" source="org.eclipse.jst.jee.server:Duck"/>

Notice : My project Name is Duck . 注意 :我的项目名称是Duck

Now in order for you to access your web-app without project name replace path="/Duck" to just path="/" or You can set it to any name you want. 现在,为了不使用项目名称访问Web应用程序,请将path="/Duck"替换为path="/"或者您可以将其设置为所需的任何名称。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM