Red Hat Web Application Framework 6.1 Manuel D’Utilisation

Page de 230
28
Chapter 5. WAF Component: Presentation
5. Fire the control event.
When a client sends a request to a Bebop page (e.g. a mouse-click on a tab); only one component
receives the request. This triggers the respond method of that component only; no other compo-
nents response methods are involved.
If the request state is deemed valid, the selected component has the opportunity to respond, perhaps
changing the request state and thus the outcome of further processing.
A control event handles form submission, control links, and has influence on the state and visibility
before any output is produced.
6. Fire the action event.
The action event is an opportunity for any component to run code before the response is committed
and after the controlling component has responded.
Any component may listen and edit state and visibility before any output is produced. This is the
last opportunity to edit before XML is written out.
7. Generate XML.
The components generate the XML. They write to the document created in the first step. Each
component generates its own semantic XML (such as XUL, Mozilla’s presentation-based cross-
platform markup language) and also delegates to its children. A DOM is built.
8. Transform the XML.
The XML document is transformed with an XSLT stylesheet and sent back to the client in the form
of HTML and CSS.
By following this method, it is easy to define and maintain a style and layout uniformity. A devel-
oper or designer can drop a different XSLT into the last step in a page request cycle.
9. The client receives the transformed results of the page request.
5.4.2. JSP Integration with Bebop
JSP is integrated with Bebop components (XML sources) and XSLT by using a JSP tag library to
allow the use of Bebop components in an otherwise standard JSP. The JSP tag libraries accomplish
this by performing transformations on the XML document produced by a Bebop page. This JSP tag
library also directs the generation of output by rendering the resulting XML document through XSLT,
so that the included components displayed in a JSP are styled with the standard template rules that are
used on the rest of the site. See Appendix A Bebop Tag Library Reference.
Java developers can also construct their Bebop pages in JSP. The tag library for declaring Bebop pages
is separate from the one for displaying Bebop components, but they are intended to work together. This
is different from using a Bebop component inside of JSP. In this instance, the specific Bebop JSP tags
takeover JSP similar to writing and controlling a servlet.
There are several motivating factors for integrating JSP with Bebop. First, laying out pages using JSP
integration will allow web developers who are not Java programmers to use third-party web publishing
tools (Dreamweaver, etc.) to alter the layout of pages, add new components to an existing page, edit
form field labels or prompts, etc. It would also be possible to make completely new pages with JSP
that display components from existing Bebop pages.
Second, JSP is a convenience for Java developers creating Bebop pages, because JSP shortens the
development cycle for individual pages by eliminating the need for a manual recompile and server
restart when a page is changed.
The overall request pipeline for constructing a page with Bebop and displaying it with JSP follows
this sequence: