Create a WAR file.
Information:
The WAR (Web Application Archive) file contains a web application and has a specific directory structure. The top-level directory of a WAR is the document root of the application. The document root is where JSP pages, client-side classes and archives, and static web resources (e.g.: *.html, *.js, *.css, images etc.) are stored.
The document root contains a subdirectory called WEB-INF, which contains the following files and directories:
- The web application deployment descriptor file (web.xml)
- Tag library files (*.tld)
- The directory classes, contains server-side classes (servlet, utility classes, JavaBeans components etc) and properties files.
- The directory lib, contains JAR archives (tag libraries and any utility libraries called by server-side classes).
Operating system used:
Windows XP Home Edition Version 5.1 SP 2
Software prerequisites:
Java 2 Standard Edition (J2SE) SDK, version 1.3 or higher.
Related information:
Procedure:
- Create the following directory structure:
| c:\demo_app |
This directory is called the document root and contains static web resources: *.html, *.jsp, *.css, *.js, images etc. |
| c:\demo_app\WEB-INF |
The WEB-INF is required and it contains a web application deployment descriptor file (web.xml). If you have tag library files you should put it here. |
| c:\demo_app\WEB-INF\classes |
Put your server-side classes (servlet, utility classes, JavaBeans components etc.) and properties files in this directory. |
| c:\demo_app\WEB-INF\lib |
Put your jar files (tag libraries, utility libraries called by server-side classes etc) in this directory. |
- To package the demo_app directory into a single file:
- Open a dos window
- Type: cd c:\demo_app
- Type: jar cvf demo_app.war .
Note: You can give this war file any name you want, for example:
jar cvf anothername.war .
- The demo_app.war can be found in c:\demo_app.
|