How to change Context-root of an application in MyEclipse
Before going to develop a web application, make sure all the settings and properties of MyEclipse, java and tomcat settings. If you have any doubts while Configuring java in MyEclipse or Installing and configuring Tomcat in your local machine or Configure the Tomcat in your MyEclipse to develop your web application take a look at my previous posts.
Normally we work on the same project most of the time with the same application name(context-root). When ever we take a new workspace in our local machines we may confuse while deploying the application in Tomcat or any other server. Other wise we have to remove the old deployed project and deploy the latest project. To overcome this problem, we can change the Context-root of our application. So that we can deploy the same web application with different names.
This is our Servlet application. This is running with the Context-root as WebApp . Now we are going to change the context root to WebApplication in myeclipse. Download the application before you are going to start as a test.
This is our application Structure.
This is our Servlet application. This is running with the Context-root as WebApp . Now we are going to change the context root to WebApplication in myeclipse. Download the application before you are going to start as a test.
This is our application Structure.
Right click on the application , then click on properties option at the bottom.
Select Web option from the left side MyEclipse options from the below window. As shown in number (2) select Context Root tab and change the previous context root(/WebApp) to (/WebApplication), then click ok button.
Now Click OK
click on Finish button.
Note:Once changing the context root of an application you have to remove the old deployed application and stop the server. Now Redeploy the same application to Tomcat Server and start the server. This is the important step to take care.
Now go to the browser and run the application with different context root : http://localhost:8080/WebApplication/
Reference Books: