Spinning Your Code with XSLT and JSF in Cocoon, Page 3
Either of the two approaches above has significant potential benefit, but perhaps even more so for the second method. They include:
- Use of the significant expressive power of XSL for the component designer (or, more accurately, the designer of the Renderer for the components).
- Easy page design, with the page design isolated from the complexity of XSL.
- The page designer can, however, select the display for each element, and specify options and formatting specifications through the use of simple attributes, just like HTML (with which they are no doubt already familiar).
- Capabilities (validation, state-saving, isolation from application logic) of JSF.
- The ability to change a component's appearance in all pages by altering one stylesheet.
- The ability to customize a component's appearance in a single page by calling an overriding stylesheet for that page.
- The ability to switch output formats (to WML, PDF, XSL, SVG, or JPG) with an alternate rendering stylesheet, no application changes required.
- All of Cocoon's other functionality (such as easy internationalization) is available to the developer.
Hopefully, you've seen in this article that it is not only possible, but indeed quite practical, to put the new JSF standard to use with a display technology other than JSF, and have gained some idea how that might be done. A number of open-source projects are already underway to provide implementations of the JSF standard, including MyFaces, Smile, and the Keel meta-framework, from which the above examples were drawn.
About the AuthorMichael Nash is the president of JGlobal Limited, a software development, consulting, training and support company specializing in open source Java technologies. He is also a core developer of the Keel meta-framework, the author of two books and a number of articles and papers about next-generation web-application development with Java, and a member of the JSR-127 (JavaServer Faces) Expert Group. He can be reached at email@example.com.
Page 3 of 3