O'Reilly logo

Java and XSLT by Eric M. Burke

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Servlet Implementation

We are almost finished! The remaining piece of the puzzle is to coordinate activity between the web browser, database, domain objects, JDOM producers, and XSLT stylesheets. This task lies in the servlet implementation and related classes. In an XSLT-driven web application, the servlet itself really does not do all that much. Instead, it acts as a mediator between all of the other actions taking place in the application.

Figure 7-9 shows the UML class diagram for the com.oreilly.forum.servlet package. This design consists of a few key classes along with numerous subclasses of Renderer and ReqHandler. These subclasses are very repetitive in nature, which is indicative of the highly structured application design that XML and XSLT facilitate.

Servlet design

Figure 7-9. Servlet design

A single-servlet design has been adopted for this application. In this approach, the ForumServlet intercepts all inbound requests from clients. The requests are then delegated to subclasses of ReqHandler, which handle requests for individual pages. Once the request has been processed, a subclass of Renderer selects the XML and XSLT stylesheet. XSLTRenderHelper does the actual XSLT transformation, sending the resulting XHTML back to the browser.

This is not designed to be a heavyweight web application framework. Instead, it is just a simple set of coding conventions and patterns that help keep the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required