Java & J2EE Page 3 - Overview of Java Web Technologies, Part 1 |
To run your servlet applications, you need a servlet container. One such container is Tomcat, the most popular container, which is an open-source project. The code in this book was tested using Tomcat, but you can use any Servlet 2.3-compliant servlet container to run it. NOTE: JSF is currently based on the Servlet 2.3 specification, but this may change. The release version may be based on the Servlet 2.4 specification (to be released soon also). When you first install Tomcat (Appendix A provides step-by-step instruction on installing and configuring Tomcat), several directories are created under the directory in which you install Tomcat. Tomcat’s directory structure is shown in Figure 1.
In Figure 1, Tomcat is installed in the tomcat5 directory. This directory is also known as %CATALINA_HOME%. One of the subdirectories is webapps. This is the parent directory of every Web application that will be run under this Tomcat installation. When you first install Tomcat, a number of sample applications are also created: jspexamples, ROOT, servlets-examples, and tomcat-docs. Therefore, a directory under webapps is called an application directory, and it contains the resources for a particular application. For an example of an application directory structure, look at the jsp-examples application directory. All static resources and JSP files are stored directly under the application directory. For better organization, you can create subdirectories under the application directory. For example, you may want to create a jsp directory for all JSP pages and an images A Web application normally has a deployment descriptor, which is an XML file called web.xml containing the description of the application. You store the web.xml file under WEB-INF. We’ll take a look at the deployment descriptor in the next section.
blog comments powered by Disqus |