provided by: 
Originally published at Internet.comDeveloping Web Applications using Java Servlets, JavaServer Pages, and other J2EE technologies is fun! However, the more interesting your application becomes, the more complicated your build process. In this article, I will sketch out a framework for how to use simple tools (like Ant and JUnit) and a simple directory structure to avoid many of the common growing pains of application development.
Conclusion
I hate articles that make you wade through mountains of verbosity before telling you what you need to know, so I'll summarize the main points of this article right up front: * Use Ant (duh). * Use a sensible directory. * Keep your build directory totally separate from your source directory. * Store all JAR files in a common lib directory, and copy or refer to them as needed. * Plan for multiple web.xml files (they may need to change if you want to deploy on more than one server). * Make an ant build target for Unit Testing, and use it as (or from) your default target.
Ant and Its Targets
Ant is a great open-source development tool from the Jakarta Project. If you haven't already, you should go download it from http://jakarta.apache.org/ant/, follow the install instructions for your platform, and look at the manual. I strongly recommend putting the ant executable on your PATH, so you can just run "ant" from the command line. Recent versions of ant make this as easy as setting a few environment variables...
Read article at Internet.com site