Web applications have a directory structure, which is 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 web application in compressed form.
A special directory under the document root, WEB-INF, contains information related to the application that is not in the public document tree. 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 J2SE specification. The following is an example directory structure of a simple web application:
+ hello/ |--- index.jsp |--+ META-INF/ | |--- MANIFEST.MF '--+ WEB-INF/ |--- web.xml '--- sun-web.xml |