Knowledgebase: Tomcat/Java
What is the directory structure for my Context?
Posted by Admin on 12 June 2003 03:27 PM
*.html, *.jsp, etc. - The HTML and JSP pages, along with other files that must be visible to the client browser (such as JavaScript, stylesheet files, and images) for your application. In larger applications you may choose to divide these files into a subdirectory hierarchy, but for smaller apps, it is generally much simpler to maintain only a single directory for these files.


/WEB-INF/web.xml - The Web Application Deployment Descriptor for your application. This is an XML file describing the servlets and other components that make up your application, along with any initialization parameters and container-managed security constraints that you want the server to enforce for you.


/WEB-INF/classes/ - This directory contains any Java class files (and associated resources) required for your application, including both servlet and non-servlet classes, that are not combined into JAR files. If your classes are organized into Java packages, you must reflect this in the directory hierarchy under /WEB-INF/classes/. For example, a Java class named com.mycompany.mypackage.MyServlet would need to be stored in a file named /WEB-INF/classes/com/mycompany/mypackage/MyServlet.class.


/WEB-INF/lib/ - This directory contains JAR files that contain Java class files (and associated resources) required for your application, such as third party class libraries or JDBC drivers.
When you install an application into Tomcat (or any other 2.2/2.3-compatible server), the classes in the WEB-INF/classes/ directory, as well as all classes in JAR files found in the WEB-INF/lib/ directory, are made visible to other classes within your particular web application. Thus, if you include all of the required library classes in one of these places (be sure to check licenses for redistribution rights for any third party libraries you utilize), you will simplify the installation of your web application -- no adjustment to the system class path (or installation of global library files in your server) will be necessary.
(1552 vote(s))
This article was helpful
This article was not helpful

Comments (12)
Roy
25 January 2007 10:37 AM
Kelvin
25 January 2007 10:37 AM
Faggot
25 January 2007 10:38 AM
Arnold
02 February 2007 04:19 PM
Kelvin
02 February 2007 04:19 PM
Bob
02 February 2007 04:19 PM
GanjaBoy
02 February 2007 04:20 PM
His_wife
02 February 2007 04:20 PM
GanjaBoy
04 February 2007 08:47 PM
Wolf
04 February 2007 08:47 PM
Maxx
06 February 2007 09:35 PM
His_wife
06 February 2007 09:36 PM
Post a new comment
 
 
Full Name:
Email:
Comments:
Help Desk Software by Kayako Resolve