Hier sind einige Informationen über JSF 2 gespeichert.
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:cc="http://java.sun.com/jsf/composite"
>
<cc:interface>
<cc:attribute name="status" default="begin"/>
</cc:interface>
<cc:implementation>
<script type="text/javascript">
jsf.ajax.addOnEvent(function(data) {
document.getElementById('#{cc.clientId}:status').style.visibility =
data.status == '#{cc.attrs.status}' ? 'visible' : 'hidden';
});
</script>
<div id="#{cc.clientId}:status" style="visibility: hidden;">
<cc:insertChildren/>
</div>
</cc:implementation>
</html>
Verwendung zum Beispiel wie folgt:
<test:ajaxStatus> <h:graphicImage value="/images/wait30trans.gif"/> </test:ajaxStatus>
<?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:c="http://java.sun.com/jsp/jstl/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:cc="http://java.sun.com/jsf/composite"
>
<cc:interface name="test">
<cc:attribute name="element" required="true"/>
<cc:attribute name="rendered"/>
</cc:interface>
<cc:implementation>
<c:if test="#{!rendered or rendered}">
<h:outputText value="<#{cc.attrs.element} id="#{cc.clientId}"" escape="false"/>
<c:forEach items="#{cc.attributes}" var="attribute">
<h:outputText value=" #{attribute.key}="#{attribute.value}"" escape="false"
rendered="#{!attribute.key.startsWith('javax.faces') and
!attribute.key.startsWith('com.sun') and
attribute.key != 'element' and
attribute.key != 'rendered'}"/>
</c:forEach>
<h:outputText value=">" escape="false"/>
<cc:insertChildren/>
<h:outputText value="</#{cc.attrs.element}>" escape="false"/>
</c:if>
</cc:implementation>
</html>