separating Markup from Component hirarchy in JSF
All JSP, facelets and JSFTemplating make use of xml (or xml-like) syntax to define a view in JSF. All of them allow to intermix markup with components directly in the page - this is good from the perspective of a traditional web-designer, who makes the step from pure web-design to building dynamic web-frontends. A good example of a near perfect implementation of this principle is the jsfc-attribute in facelets that allows to set the componet to be used in this place while making use of pure xhtml-syntax to define the markup.
So you may ask: 'what's so bad about this?' From the perspective of the web-designer there's nothing wrong with this - Such templating makes it extremely straightforeward to get it's job done while making maximised use of his preexisting knowledge.
But is it giving you substantial more benefit than just adding some dynamics to your previously static html-page?
Does it allow you to define and reuse more complex display-logic? Does is really separate the visual representation from the non-visual logical structure of the user-interface? Does it allow to make use of complex compound-components while distributing it's collobarating components arbitrary on the page? Does it help you defining such compound-components independent from the resulting markups structure?
While in the reall world being quite tightly coupled, on a higher level of abstraction visual representation and logical grouping of components in a tree are separate concerns that are orthogonal to each other. If components in the component tree would have a markup-independent logical structure, the components a compound-component consist of, would just be the children of a container-component and could easily make use of their structural relationship to collaborate. The client-ids of these components would clearly visualize the logical component-relationships (and not their position in rendered markup). And finally these logical clientids could be used to reference the components in the actual markup-defining template that is applied to the component tree in a last step of rendering.
This idea is actually not really new - Hans Bergsten describes such thing in his blog-entry Improving JSF by Dumping JSP on the 06/09/2004. Sad to say such thing didn't make it into the standards yet.
I hope by getting some of these ideas into JSF 2.0 we might make life easier for both the page-author and the component-developer.
- Login or register to post comments
- Printer-friendly version
- ntruchsess's blog
- 608 reads





