title: Planning structure for a WAR file
body: <p>I am creating my first WAR file.  I have been experimenting with ant buildfile syntax, and the first part of my buildfile takes content from my Eclipse project and places it into a <code>/dist</code> folder, which will then be zipped up into a WAR file in subsequent steps.  </p>
  
  <p>I need help structuring the output so that the WAR file has all the required contents in the right places for execution by Tomcat 7 server.  Please cut me some slack, because this is my first WAR file.  </p>
  
  <p>The current draft of my buildfile generates a dist folder with the following structure:  </p>
  
  <pre><code>dist/META-INF/MANIFEST.MF  
  dist/WEB-INF/classes/myapp/package1/ (contains 12 .class files)  
  dist/WEB-INF/classes/myapp/package2/ (contains 7 .class files)  
  dist/WEB-INF/jsp (contains 5 .jsp files)  
  dist/WEB-INF/lib (contains 16 .jar files)  
  dist/WEB-INF/web.xml  
  dist/image1.gif  
  dist/image2.gif  
  dist/image3.gif  
  dist/image4.gif 
  </code></pre>
  
  <p>How do I need to change the structure so that the resulting WAR file can be used by Tomcat 7 server to serve up my web application to end users?  </p>
  
  <p>Specifically,<br>
      1.) should I include .java files in <code>dist/WEB-INF/classes/...</code> or just put .class files there?<br>
      2.) should I add JRE System Library JARs into <code>dist/WEB-INF/lib</code>?  These System JARs are in my Eclipse workspace, but I do not know if I need them in the WAR file.<br>
      3.) is <code>web.xml</code> in the right place?<br>
      4.) should my .gif files stay in the root directory?<br>
      5.) are my .jsp files in the right place?<br>
      6.) where does <code>myapp.xml</code> go?  <code>myapp.xml</code> is in the root directory of my Eclipse workspace, and seems essential when loading myapp into my localhost instance of Tomcat server.  Is <code>myapp.xml</code> required in a WAR file?  Or does the structure of the WAR file do the things that <code>myapp.xml</code> would otherwise do?  </p>
  
  <p>Please note that my servlet classes control all access to my JSP files, and each servlet instantiates its own JSP with the syntax:  </p>
  
  <pre><code>RequestDispatcher jsp = context.getRequestDispatcher("/WEB-INF/jsp/home.jsp");  
  </code></pre>
  
  <p>All access to site content is through URLs defined by web.xml's servlet mapping.  </p>
  
  <p>Thank you in advance for your help.  I am trying to learn this first one correctly so that I can make subsequent WAR files well the first time.  And I am sure other people will need these answers as a resource later.  </p>