JSF Desktop is a library to support JSF 2 (2.0, 2.1) with some basic features to extend JSF.
Configuration#
In the pom.xml use:<dependency> <groupId>com.intersult</groupId> <artifactId>jsf-desktop</artifactId> <version>1.1-SNAPSHOT</version> </dependency> <repository> <id>intersult-repository</id> <name>Intersult Repository</name> <url>http://repository.intersult.com/repository</url> </repository>
In the web.xml use:
<context-param> <param-name>javax.faces.FACELETS_RESOURCE_RESOLVER</param-name> <param-value>com.intersult.jsf_desktop.util.ClassPathResourceResolver</param-value> </context-param>
Access via http://localhost/faces/resource/<test.xhtml>
Insert-Tag#
The Insert-Tag can insert UIComponent objects into the component tree. This is usefull when creating XHTML-Components with namespace http://java.sun.com/jsf/composite/...Example#
Imagin a component which evenly distributes Command-Buttons in a form. You'de like to create a component (luckily this is already included in JSF Desktop). The component should wrap each contained component in a SPAN-Tag with some padding.Solution: You iterate through the children and write a span for each child. Into the span you insert the child itself. With normal JSF-Tags this is not possible, you need <i:insert>
<?xml version="1.0" encoding="UTF-8"?> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:cc="http://java.sun.com/jsf/composite" xmlns:p="http://primefaces.prime.com.tr/ui" xmlns:i="http://intersult.com/taglib" xmlns:dt="http://java.sun.com/jsf/composite/desktop" > <cc:interface> <cc:attribute name="align"/> </cc:interface> <cc:implementation> <div style="margin-top: 10px; text-align: #{empty cc.attrs.align ? 'center' : cc.attrs.align};"> <ui:repeat value="#{cc.children}" var="child"> <span style="margin-right: 5px;"> <i:insert component="#{child}"/> </span> </ui:repeat> </div> </cc:implementation> </html>