One of the great things about Java Servlets and Java Server Pages is their portability. You can create a Java Servlet, compile it and run it under Apache's servlet container and then run the same servlet, unchanged, under Allaire's JRun servlet container.
Java's Web Application solves all these problems by specifiying where servlets and class files should go (in a folder called classes), where jar files should go (in a folder called lib), where security privialges should be specified (in the deplayment descriptor - web.xml), etc.