How to deploy web applications on Tomcat
In this tutorial, we describe 2 ways for deploying Java web applications on Tomcat application server.
1. War file
The typical way for deploying a Java web application on Tomcat is to archive the application in a WAR file and deploy the file directly under {TOMCAT_HOME}/webapps.
In order to access the application, simply append the name of the war file to the URL of Tomcat.
2. Context file
Another way of deploying the Java web application on Tomcat is to define a context XML file under {TOMCAT_HOME}/conf/Catalina/localhostĀ with the following format:
1 2 | <?xml version="1.0" encoding="utf-8"?> <Context reloadable="false" docBase="E:\Workspace\Test-Web" useHttpOnly="false"/> |
where docBase attribute points to the location of the web application, and the name of XML defines the application name.
In order to access the application, simply append the name of the context XML file to theĀ URL of Tomcat.