Tomcat Web Application Directory Structure

What is webapps folder in tomcat?
webapps folder is the appBase for host name localhost.
This will be configured in conf/server.xml.

eg.



            unpackWARs=”true” autoDeploy=”true”>

you can change default webapps folder by editing appBase in host tag.

Eg.



            unpackWARs=”true” autoDeploy=”true”>


What is exampleapp in the above image?
It is the name of the webapplication which is deployed in tomcat.

Here index.jsp is welcome file. This will be configured in web.xml file under WEB-INF folder.

Images/
–> this folder will contain all the images are used in this application.

META-INF/
This is optional folder.
Tomcat uses the Context configuration element to contain information about components required by a given application, such as databases, realms, or custom loaders.  Additionally, the Context element can be configured with a wide variety of attributes that control things such as loggingreload permissions, caching, and more.

WEB-INF/
This folder will not be visible to the end user.
This folder contains jar files (libs), java compiled codes(class files), properties files, xml’s and logs. 

Classes/
–> this folder will have compiled codes of java files. 
Which will contain Java, Servlets, Filter , Struts, Hibernates (All java and j2ee codes ).. etc

web.xml
This is the configuration file of web application.
Here Servlet, filter, web service mapping will be done with initial values.