Saturday, February 14, 2015

The Structure and Deployment of Web Applications


A Web Application that may contain below contents.
(a) Static content
(b) JSP pages
(c) Servlet classes
(d) Deployment descriptor
(e) Tag libraries
(f) JAR files, and
(g) Java class files


A Web application exists as a structured hierarchy of directories.The root of this hierarchy serves as the document root for files that are part of the application.The root directory is usually known as the context path for example. When you access a web application www.test.com/MyWebApplication, 'MyWebApplication' is the document root which is also known as context path.


A special directory exists within the application hierarchy named "WEB-INF". This directory contains all things related to the application that aren't in the document root of the application.

The WEB-INF node is NOT part of the public document tree of the application hence no file contained in the WEB-INF directory may be served directly to a client by the container. However, the contents of the WEB-INF directory are visible to servlet code using the getResource and getResourceAsStream method calls on the ServletContext, and may be exposed using the RequestDispatcher calls

The contents of the WEB-INF directory are:

The /WEB-INF/web.xml deployment descriptor.

The /WEB-INF/classes/ directory for servlet and utility classes. The classes in this directory must be available to the application class loader.

The /WEB-INF/lib/*.jar area for Java ARchive files. These files contain servlets, beans, and other utility classes useful to the Web application. The Web application class loader must be able to load classes from any of these archive files.

No comments:

Post a Comment