简体   繁体   中英

How to change path for web project in eclipse

I wrote the web application using Spring MVC. When I deploy the app to the server path is localhost:8080/projectName/ . It is possible to remove projectName from path from eclipse? I found path in project properties but I cannot find the way how to change it.

I found that I have to change context root to : "/". I changed it but that has no effect. Thank you for any help.
Regards,
Sebastian

I would break down your question into two parts :

A. Changes to the context root not taking any effect.

For changes to the context root to take effect, you must clean and republish you webapp on your server for the context root changes to get activated. To run "Clean" in context of the server from within eclipse,

  1. Stop the Server
  2. Window -> Show View -> Server -> Right click on your server configuration -> Clean. (Note: To "Clean" the server outside of eclipse, you need to go to the "webapps" directory of your server on your local filesystem and delete the .war file as well as the "project-name" folder which holds the exploded WAR file. )
  3. Deploy your webapp to the server and restart the server.

B. Trying to run your webapp at the context root / - localhost:8080

From what it looks like, you are trying to run your web application at the "Root" of your application server. You haven't mentioned the application server that you are using, but let us for example assume that the server you are using is tomcat. For tomcat, to deploy an application which will run at localhost:8080/ you need to either deploy the exploded war under the "ROOT" directory at $CATALINA_HOME/webapps/ROOT , or name your war file to be root.war.

The $CATALINA_HOME/webapps/ROOT and $CATALINA_HOME/webapps/root.war are special keywords which tell tomcat to deploy the application at content root /.

If you are NOT using tomcat as your application server, then provide more details on the application server being used to see if I can help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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