|
Download
FAQ History |
|
API
Search Feedback |
Web Applications
Web components and static Web content files such as images are called Web resources. A Web application is the smallest deployable and usable unit of Web resources.
Web applications are typically packaged and deployed as Web archive (WAR) files. The format of a WAR file is identical to that of a JAR file. However, the contents and use of WAR files differ from JAR files, so WAR file names use a
.warextension.In addition to Web components and Web resources, a Web application can contain other files including:
The top-level directory of a Web application is the document root of the application. The document root is where JSP pages, client-side classes and archives, and static Web resources are stored.
The document root contains a subdirectory called /
WEB-INF/, which contains the following files and directories:
web.xml--The Web application deployment descriptor- Tag library descriptor files (see Tag Library Descriptors)
classes--A directory that contains server-side classes: servlets, utility classes, and JavaBeans componentslib--A directory that contains JAR archives of libraries called by server-side classesYou can also create application-specific subdirectories (that is, package directories) in either the document root or the
/WEB-INF/classes/directory.The WAR structure just described is portable; you can install it into any container that conforms to the Java Servlet Specification.
Packaging a Web Application
You package Web application into a WAR by executing the
jarcommand in a directory laid out in the format of a Web module or by using theAntwartask. This tutorial uses the latter approach. To build and package thehello1application into a WAR namedhello1.war:
- In a terminal window, go to
<INSTALL>/jwstutorial12/examples/web/hello1/.- Run
antbuild. This target will spawn any necessary compilations and copy files to the<INSTALL>/jwstutorial12/examples/web/hello1/build/directory.- Run
antpackage. This target creates a WAR in the directory<INSTALL>/jwstutorial12/examples/web/hello1/dist/.A sample
hello1.waris provided in<INSTALL>/jwstutorial12/examples/web/provided-wars/.
|
Download
FAQ History |
|
API
Search Feedback |
All of the material in The Java(TM) Web Services Tutorial is copyright-protected and may not be published in other works without express written permission from Sun Microsystems.