JSF Desktop is a library to support JSF 2 (2.0, 2.1) with some basic features to extend JSF.
<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>
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>
Bei einigen Features und Konstellationen ist es von Vorteil, bestimmte Konfigurationen vorzunehmen.
Falls man feststellt, dass die Events im JSF Desktop nicht arbeiten, Oberflächenelemente nicht aktualisiert werden und Messages nicht angezeigt werden, dann arbeiten vermutlich auch übliche JSF-Annotations @ManagedBean oder @SessionScoped nicht. Abhilfe schafft dann:
<context-param> <param-name>com.sun.faces.injectionProvider</param-name> <param-value>com.intersult.jsf_ext.event.EventInjectionProvider</param-value> </context-param>