Chapter 12. Developing for the Web
This chapter covers:
We now have a library to create entries in a diary, a build process that can handle multiple projects, and a way of sharing artifacts between them. What next? How about building a web site that uses the diary library and can publish events as an Atom feed?
It’s time to build a Java Web Application, the public face of most server-side Java. This chapter looks at what you have to do to build and test one. Web applications are more complex to package than the simple JAR files we’ve done so far, and before they can be tested, they must be deployed. This makes the build process much harder than what we’ve done so far. Ant will have a more complex packaging problem to deal with, and it will have to deploy our code onto a web site before testing it. Solving problems like these are where Ant shows what it can really do!
A Java web application is a web site packaged into a JAR file. The JAR file contains libraries, code, and resources—the pages, images, and other content that together form the web site. The resources provide the static parts of the web site, while the Java classes, libraries, and JSP/JSPX content form the dynamic part of the application.