Uncategorized

Directory Structure of a Web Context

All the Java web application (servlet, JSP, JSF, web services) follows a standard structure, which enables deployment in a Java-capable web server (such as Apache Tomcat and Glassfish). A web context may contain many types of files, such as HTML, CSS, Scripts, images, JSP, servlet, utility classes, external lib aries (jar files). All these files are to be kept under a standard directory structure, as illustrated:

  • WebContextRoot: The directory that your application resides is called the context root (or document base directory). You should keep all your HTML files and resources visible to the web users (e.g., CSS, Scripts, images, JSPs) under the context root. You can create sub-directory, such as scripts and images, under the context root.
  • WebContextRoot\WEB-INF: This directory, although under the context root, is not visible to the web users. This is where you keep your application specific configuration files such as web.xml.
  • WebContextRoot\WEB-INF\classes: This is where you keep all the Java classes such as servlets class-files
  • WebContextRoot\WEB-INF\lib: This is where you keep the jar files and native libraries, from external parties.
  • WebContextRoot\WEB-INF\src: You can keep your source files here or outside the web context. Source files are usually not distributed in production.
  • WebContextRoot\META-INF: Like WEB-INF, this directory is also not visible to the web users. This is for Tomcat specific configuration option files, such as context.xml.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s