User's Manual

20 Chapter 5. WAF Component: Presentation
JavaServer Pages (JSP) is a J2EE standard for scripting dynamic web pages. JSPs typically produce
HTML, though they can generate any XML markup. WAF supports the use of JSPs as a primary
means of writing web UIs.
5.2. CSS and XSLT
WAF uses two technologies together, CSS and XSLT, to add style to logical (i.e. all form, no style)
markup.
CSS is used to control the style properties of HTML documents. CSS has broad browser support
and fine-grained control of properties such as color, borders and padding, positioning, and typeface.
Unlike XSLT, CSS cannot change the structure of the document it is styling. It cannot, for instance,
turn a bulleted list into a table.
Bebop uses CSS in the HTML that it produces when it transforms source Bebop XML. JSPs may
also use CSS. Consistent use of CSS under both regimes will give your site a more consistent look
and feel.
XSLT is used to transform the structure of an input document into a new and different structure on
output. This is very useful for creating modeling and then rendering UI concepts that do not exist
in HTML. A tabbed pane, for instance, is not part of the HTML standard, but a block of HTML
that functions as a tabbed pane can be produced by transforming source XML describing tabs into
a concrete HTML rendering.
Bebop, by design, produces XML that is not fit for direct consumption by a browser. Instead, it is
transformed first using XSLT. JSPs, by contrast, typically produce HTML directly and so will not
generally make use of XSLT. This is not, however, a rule. When it makes sense, a JSP author may
wish to produce XML and transform it using XSLT.
5.2.1. Integrating XSLT with WAF
WAF integrates XSL stylesheets in the following way:
It provides a default stylesheet as an integral part of each WAF package, so that each package ships
with some way to style the content it generates.
It allows the defaults for any package to be overridden when that package is invoked from a partic-
ular URL pattern. This allows for co-branding, etc.
It allows for special-usage page scripts (for example, JSP/XSL pairs) which can import site-wide
styling rules.
Note
WAF infrastructure depends on the Xalan-J XSLT engine from the Apache XML project. In turn, this
engine depends on the Xerces XML parser, also from Apache. Although it is theoretically possible to
use a different XML parser with Xalan, this process hasn’t been thoroughly tested. It is also possible
to use a different XSLT engine, such as Saxon. WAF contains no explicit dependency on any vendor’s
XSLT engine.
This flexibility comes from the PresentationManager interface, whose one method servePage
obtains a transformer for the current request, applies it to an input document, and serves the trans-
formed output to the response output stream. A WAF application’s dispatcher can use the provided