[JSF Desktop] is a library to support JSF 2 (2.0, 2.1) with some basic features to extend JSF.

!!!Overview
The main features of the [JSF-Ext] (formerly JSF Desktop) are:

* __Events:__ Event sources and registration. Java beans and components can produce events, other beans and components can consume them. This includes rendering and updating components, even using AJAX requests.
* __Messages:__ Clean message handling. Exceptions are converted to faces messages, using normal or AJAX requests. An event is raised, thus you can update your message components.
* __Dynamic Includes:__ Clean component tree and small network traffic. Facelets can dynamically are loaded from XHTML sources when needed through AJAX requests. No more overloaded component trees, no waiting for loading all the megabytes to your browser. You can include as much popups, tabs and other elements in your page without slowing it down. Everything is just loaded when needed. And much better, its also can be unloaded when finished. Both DOM and component tree stays clean.
* __Custom Scopes:__ Use custom scopes within your loaded facelets, they are cleaned up when finished. No more manual clearing of data from popups. Nice memory footprint and save data.
* __Integration:__ [JSF-Ext] works perfectly together with Richfaces, Primefaces and other component libraries.

!!!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>}}}

!!!Konfiguration
[JSF Desktop] ist darauf ausgelegt, ohne größere Konfiguration benutzt werden zu können. Viele Features können Out-of-the-Box verwendet werden, sobald sich das jsf-desktop.jar in der Web-Application befindet.

Bei einigen Features und Konstellationen ist es von Vorteil, bestimmte Konfigurationen vorzunehmen.

!!Annotations und InjectionProvider
Wie bereits in [JSF2] erwähnt, werden in einigen Servlet-Containern die Annotations nicht verarbeitet. [JSF Desktop] registriert einen sogenannten InjectionProvider, was im Normalfall transparent funktioniert.

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>
}}}