Facelets
Facelets is an open source web framework under the Apache license and alternative view handler technology for the JavaServer Faces (JSF). The framework requires a valid input XML documents to work. This means that all web pages must be valid XHTML format. Facelets supports all of the JSF UI components and builds its own component tree, reflecting the view for a JSF application. Although both JSP and JSF technologies have been improved to work better together, Facelets eliminates the issues noted in Hans Bergsten's article "Improving JSF by Dumping JSP"[1]
Facelets is similar enough to Apache Tapestry to draw comparison. In fact, Tapestry was well ahead of its time when it first came out, and Facelets does draw on some of its ideas. The project conceptually similar to Tapestry's which use jwcid
attribute and Facelets uses jsfc
and proper namespaces to convert HTML elements to their associated JSF component. Also, there are some similarity to Tiles framework and support templating as well as composition.
As the next development of JavaServer Faces 2.0, the specification is widely influenced by Facelets and expected to be part of the standard JSR 314.
Example
The following example shows an XHTML template for taking the use of Facelets component-aliasing. The jsfc
attribute is used here, shows which tags to replace when compiling the page with the corresponding JavaServer Faces components.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html">
<body>
<form jsfc="h:form">
<span jsfc="h:outputText" value="Welcome, #{loggedInUser.name}" disabled="#{empty loggedInUser}" />
<input type="text" jsfc="h:inputText" value="#{bean.property}" />
<input type="submit" jsfc="h:commandButton" value="OK" action="#{bean.doSomething}" />
</form>
</body>
</html>
The above code can be viewed in a browser, and edited with conventional WYSIWYG design tools. This is not possible with regular JSF 1.2 pages (shown below the same functionality).
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html">
<body>
<h:form>
<h:outputText value="Welcome, #{loggedInUser.name}" disabled="#{empty loggedInUser}" />
<h:inputText value="#{bean.property}" />
<h:commandButton value="OK" action="#{bean.doSomething}" />
</h:form>
</body>
</html>
References
- ↑ Hans Bergsten (June 6, 2004). "Improving JSF by Dumping JSP". O'Reilly Media. http://onjava.com/pub/a/onjava/2004/06/09/jsf.html.
Bibliography
- Wadia, Zubin; Marinschek, Martin; Saleh, Hazem; Byrne, Dennis (September 22, 2008), The Definitive Guide to Apache MyFaces and Facelets (1st ed.), Apress, pp. 400, ISBN 978-1590597378, http://www.apress.com/book/view/9781590597378
- Wadia, Zubin; Aranda, Bruno (May 26, 2008), Facelets Essentials: Guide to JavaServer Faces View Definition Framework (1st ed.), Apress, pp. 84, ISBN 978-1430210498, http://www.apress.com/book/view/9781430210498
See also
External links
Stub icon | This Web software related article is a stub. You can help Wikipedia by expanding it. |
If you like SEOmastering Site, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...