Thursday, 30 June 2016

What is the structure of Modern Servlet Web Applications ?


A web application exists as a structured hierarchy.
The root of this hierarchy serves as a document root.

WEB-INF
  • This directory contains all things related to the application that aren’t in the document root of the application.
  • No file contained in the WEB-INF directory may be served directly to a client by the container.
  • But, A servlet can access contents of WEB-INF using :
    • ServletContext.gerResource()
    • ServletContext.getResourceAsStream()

Contents under WEB-INF
  • /WEB-INF/web.xml
    Deployment descriptor
  • /WEB-INF/classes/*
    Directory for servlet and utility classes
    The classes in this directory are available to the application class loader.
  • /WEB-INF/lib/*.jar
    contains JAR files (Java ARchive)
    • JAR contain servlets, beans, and utility classes useful to the web application.
    • The web application class loader
      • can load class from any of these JAR files.
      • loads classes from the WEB-INF/classes first, and then from JARs in the WEB-INF/lib directory

No comments:

Post a Comment

Note: only a member of this blog may post a comment.