JSF2
This is version . It is not the current version, and thus it cannot be edited.
Back to current version   Restore this version

JSF 2.0

Composite Tags#

AJAX Status#

Die Component zeit den AJAX-Status an.
<?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:composite="http://java.sun.com/jsf/composite"
>
	<composite:interface>
		<composite:attribute name="onbegin"/>
		<composite:attribute name="oncomplete"/>
		<composite:attribute name="onsuccess"/>
		<composite:attribute name="onerror"/>
	</composite:interface>
	<composite:implementation>
		<script type="text/javascript">
			function updateBusyStatus(data) {
				<c:if test="#{cc.facets.begin != null}">
					document.getElementById('#{cc.clientId}:begin').style.visibility =
						data.status == 'begin' ? 'visible' : 'hidden';
				</c:if>
				<c:if test="#{cc.facets.complete != null}">
					document.getElementById('#{cc.clientId}:complete').style.visibility =
						data.status == 'complete' ? 'visible' : 'hidden';
				</c:if>
				<c:if test="#{cc.facets.success != null}">
					document.getElementById('#{cc.clientId}:success').style.visibility =
						data.status == 'success' ? 'visible' : 'hidden';
				</c:if>
				<c:if test="#{cc.facets.error != null}">
					document.getElementById('#{cc.clientId}:error').style.visibility =
						data.status == 'error' ? 'visible' : 'hidden';
				</c:if>
			}
			
			jsf.ajax.addOnEvent(updateBusyStatus);
		</script>
		<c:if test="#{cc.facets.begin != null}">
			<div id="#{cc.clientId}:begin" style="visibility: hidden;">
				<composite:renderFacet name="begin"/>
			</div>
		</c:if>
		<c:if test="#{cc.facets.complete != null}">
			<div id="#{cc.clientId}:complete" style="visibility: hidden;">
				<composite:renderFacet name="complete"/>
			</div>
		</c:if>
		<c:if test="#{cc.facets.success != null}">
			<div id="#{cc.clientId}:success" style="visibility: hidden;">
				<composite:renderFacet name="success"/>
			</div>
		</c:if>
		<c:if test="#{cc.facets.error != null}">
			<div id="#{cc.clientId}:error" style="visibility: hidden;">
				<composite:renderFacet name="error"/>
			</div>
		</c:if>
	</composite:implementation>
</html>

Verwendung zum Beispiel wie folgt:

<test:ajaxStatus>
	<f:facet name="begin">
		<h:graphicImage id="busyStatus" value="/images/wait30trans.gif"/>
	</f:facet>
</test:ajaxStatus>