XSLT and servlets are a natural fit. Java is a cross-platform programming language, XML provides portable data, and XSLT provides a way to transform that data without cluttering up your servlet code with HTML. Because your data can be transformed into many different formats, you can also achieve portability across a variety of browsers and other devices. Best of all, a clean separation between data, presentation, and programming logic allow changes to be made to the look and feel of a web site without digging in to Java code. This makes it possible, for example, to sell highly customizable web applications. You can encourage your customers to modify the XSLT stylesheets to create custom page layouts and corporate logos, while preventing access to your internal Java business logic.
As discussed in previous chapters, an initial challenge faced with
XSLT and servlets is the initial configuration. Getting started with
a web application is typically harder than
client-only applications because there are more pieces to assemble.
With a Swing application, for instance, you can start with a single
class that has a
main( ) method. But with a web
application, you must create an XML deployment descriptor in addition
to the servlet, package everything up into a WAR file, and properly
deploy to a servlet container. When errors occur, you see something
like “HTTP 404 -- File not found,” which is not
The goal of this chapter is to introduce ...