Web applications have a directory structure, which is fully accessible from a mapping to the application's document root (for example, /hello). The document root contains JSP files, HTML files, and static files such as image files.
A WAR file (web archive file) contains a complete web application in compressed form.
A special directory under the document root, WEB-INF, contains everything related to the application that is not in the public document tree of the application. No file contained in WEB-INF can be served directly to the client. The contents of WEB-INF include:
/WEB-INF/classes/* - The directory for servlet and other classes.
/WEB-INF/web.xml and /WEB-INF/sun-web.xml - XML-based deployment descriptors that specify the web application configuration, including mappings, initialization parameters, and security constraints.
The web application directory structure follows the structure outlined in the Java EE specification. The following example shows a sample directory structure of a simple web application.
+ hello/ |--- index.jsp |--+ META-INF/ | |--- MANIFEST.MF --+ WEB-INF/ |--- web.xml --- sun-web.xml |