Web Application Structure in JSP Page
How to integrate a web application with Tomcat Server?
Creating and Deploying War Files using JSP.
Creating a WAR file:
WAR file or Web Archive Resource file used to run an web application. To create a war file for an application name "hiox".
- Open the Commad Prompt
- Goto to webapps/hiox
- Use the "jar" command like "jar -cvf hiox.war *"
- now "hiox.war" file can be used from any server
Deploying the WAR file:
- Copy the "*.war" file to the "webapps" folder of the Tomcat server.
- Restart the Tomcat server.
- WAR file will get deployed automatically
To integrate any application using a Tomcat server an folder for that application should be created inside the "webapps" folder.
In the above example we have created a folder named "SampleApps" inside the "webapps" folder.
The files for an application is stored indside the respective folder, along with a folder "WEB-INF" which is mandatory.
Now, the following screenshot shows the folders "lib", "classes" and a file "web.xml".
The "lib" folder is used to store the ".jar" files that are specific to a application.
The "classes" folder can contain "classes" or it can have subfolders for packages like "pack" below which contains the compiled java class files.
The "web.xml" file is used to define information about servlets, url mapping for normal and error pages, it is also used specify the welcome page or the index page etc. All together this file explains creating and deploying web applications using JSP.