Web applications can be packaged and signed into a Web ARchive format (WAR) file using the standard Java archive tools. For example, an application for issue tracking might be distributed in an archive file called issuetrack.war. When packaged into such a form, a META-INF directory will be present which contains information useful to Java archive tools. This directory must not be directly served as content by the container in response to a Web client’s request, though its contents are visible to servlet code via the getResource and getResourceAsStream calls on the ServletContext. Also, any requests to access the resources in META-INF directory must be returned with a SC_NOT_FOUND(404) response.
A WAR usually contains following resources:
Servlets, JavaServer Pages (JSP), Custom Tag Libraries.
Server-side utility classes (database beans, shopping carts, and so on).
Static web resources (HTML, image, and sound files, and so on).
Client-side classes (applets and utility classes).
web.xml - the web application deployment descriptor.
Tag Library Descriptor files.
classes/ - a directory that contains server-side classes: servlet, utility classes, and JavaBeans components.
lib/ - a directory that contains JAR archives of libraries (tag libraries and any utility libraries called by server-side classes).
tags/ - a directory that contains Tag files (made easily accessible to JSPs without the need to explicitly write a Tag Library Descriptor files).
WEB-INF/ WEB-INF/web.xml WEB-INF/classes/ WEB-INF/lib/ WEB-INF/tags/
To prepare the web application for deployment, package it in a WAR file using the following jar utility command from the top-level directory of the application:
jar cvf web_app.war .where web_app is the web application name.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |