Deploying a web application to Apache Tomcat is very straightforward using a WAR (Web ARchive) file. By deploying we mean that we are placing a zipped web application in a location on the file system where Tomcat can make the web page(s) available to the world.
To learn how to deploy a WAR file to Apache Tomcat in a Windows environment, follow these 6 steps:
- You'll need to develop a basic web site first by creating a directory and a simple JSP (Java Server Page). The instructions for accomplishing these
tasks were listed in the topic
Click here to learn how set default context path in Apache Tomcat (Windows). **IMPORTANT**
Complete steps 1 and 2 only in
the aforementioned topic. Do not create the XML file that is
shown in that topic as a context descriptor is not required when deploying a WAR file. You will simply create the
c:/DemoWebsitefolder and one JSP file that is stored in
c:/DemoWebsite. If you completed that topic in the past, then stop the Tomcat server and delete
- Open a command prompt and navigate to
c:/DemoWebsite. You will execute the
jarutility provided in the Java JDK in order to create the WAR file as shown here:
- Copy the WAR file you have just created to
- Start the Tomcat server.
- In the address area of the browser, type
http://localhost:8080/DemoWebsite/DateJSP.jspand submit that address to the browser.
- The output of your JSP page will be displayed: