17.3. Creating a Web ApplicationA minimal Web application can be created by creating a couple of directories and a single configuration file. First, a directory within webapps is needed to hold the application. For the purposes of what follows a directory named example will be used. Within example a directory called WEB-INF is used to hold all configuration and resources for the application. The most important and only required element in WEB-INF is web.xml. A minimal version of this file could be as simple as This is all that is needed to start creating simple content. Pages live in the top-level example directory, and a good place to start is with an 181 file such as Chapter 18 for more on tag libraries.Once the application has been laid out according to the preceding rules, it can be packaged into a Web application resource, or.war, file with the following command:jar -c0f ../application_name.war .where application_name can be replaced with the chosen name for the application. In many application servers, including Tomcat, it is possible to deploy an application by simply placing the war file in the proper directory, which for Tomcat is webapps. |