composite
Tag interface


This element declares the usage contract for a composite component. Optionally, and at the component author's discretion, this contract exposes the features of one or more inner components to the page author. The page author can work with the composite component as a single component whose feature set is the union of the features declared in the usage contract.

For example, consider a composite component that implements the functionality of a "login panel". Such a component would likely have two text fields and one button. The user of such a component might like to do one or more of the following.

For each of the behaviorial interfaces in Section JSF.3.2 of the specification, there is a tag in the composite: library to nest inside of the <composite:interface> section.

If the <composite:interface> section is not present in a PDL page, the contract will be inferred as described in the specification. There must be zero or one of these elements in a composite component PDL file. If a <composite:interface> element does appear, there must be an accompanying <composite:implementation> element in the same PDL file.

Nesting of composite components

The implementation must support nesting of composite components. Specifically, it must be possible for the <composite:implementation> section of a composite component to act as the using page for another composite component. When a composite component exposes a behavioral interface to the using page, such as a <composite:actionSource>, <composite:editableValueHolder>, <composite:valueHolder> or other behavioral interface, it must be possible to “propogate” the exposure of such an interface in the case of a nested composite component. The composite component author must ensure that the value of the name attributes exactly match at all levels of the nesting to enable this exposure to work. The implementation is not required to support “re-mapping” of names in a nested composite component.

For example, consider this nested composite component.

Using page

  1. <ez:actionSourceOuter>
  2.   <f:actionListener for="button1" />
  3. </ez:actionSourceOuter>

actionSourceOuter.xhtml: Outer composite component

  1. <composite:interface>
  2.   <composite:actionSource name="button1" />
  3. </composite:interface>
  4.  
  5. <composite:implementation>
  6.   <ez:actionSourceInner />
  7. </composite:implementation>

actionSourceInner.xhtml: the composite component used within a composite component.

  1. <composite:interface>
  2.   <composite:actionSource name="button1" />
  3. </composite:interface>
  4.  
  5. <composite:implementation>
  6.   <h:commandButton id="button1" value="the real button" />
  7. </composite:implementation>

The id of the <h:commandButton> on line 6 of actionSourceInner.xhtml must match the name on line 2 of that file (this is a standard requirement for all composite components, nested or not). That id must also match the name on line 2 of actionSourceOuter.xhtml, and the for on line 2 of the using page.

The implementation must support any level of nesting as long as the for, name, and id values match up. Furthermore, the targets attribute is also valid for use in this nested fashion.

Naming containers within composite components

Composite components are themselves naming containers so that any possible id conflicts between inner components and components in the using page are avoided. However, special care must be taken when using naming containers in the <composite:implementation> section. In such cases the value of the “name” attribute, or the values of the “targets” attribute must be used with a clientId relative to the top level component to expose any attached object targets to the using page. For example:

Using page

  1. <ez:loginButton>
  2.   <f:actionListener for="button" binding="#{foo.actionListener}" />
  3. </ez:loginButton>

loginButton.xhtml

  1. <composite:interface>
  2.   <composite:actionSource name="button" targets="form:button" />
  3. </composite:interface>
  4.  
  5. <composite:implementation>
  6.  
  7.   <h:form id="form">
  8.     <h:commandButton id="button" value="Submit" />
  9.   </h:form>
  10. </composite:implementation>

Because the button on line 8 resides within a form, it must be referred to using a client id, relative to the top level component, in the "targets" attribute on line 2. Using a relative clientId is required due to the semantics of UIComponent.findComponent().



Tag Information
Tag ClassNone
TagExtraInfo ClassNone
Body ContentJSP
Display NameNone

Attributes
NameRequiredRequest-timeTypeDescription
namefalsefalsejavax.el.ValueExpression
(must evaluate to java.lang.String)

The name of this composite component. Advisory only. The real name is taken from the filename. The value of this attribute will be set as the value for this property on the composite component bean descriptor.

componentTypefalsefalsejavax.el.ValueExpression
(must evaluate to java.lang.String)

The component-type of the UIComponent that will serve as the composite component root for this composite component. The declared component-family for this component must be javax.faces.NamingContainer.

displayNamefalsefalsejavax.el.ValueExpression
(must evaluate to java.lang.String)

The name to display in a tool palette containing this component. The value of this attribute will be set as the value for this property on the composite component bean descriptor.

preferredfalsefalsejavax.el.ValueExpression
(must evaluate to boolean)

Is this a "preferred" component. The value of this attribute will be set as the value for this property on the composite component bean descriptor.

expertfalsefalsejavax.el.ValueExpression
(must evaluate to boolean)

Is this component only for expert users? The value of this attribute will be set as the value for this property on the composite component bean descriptor.

shortDescriptionfalsefalsejavax.el.ValueExpression
(must evaluate to java.lang.String)

A short description of the purpose of this component. The value of this attribute will be set as the value for this property on the composite component bean descriptor.


Variables
No Variables Defined.


Output Generated by Tag Library Documentation Generator. Java, JSP, and JavaServer Pages are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries. Copyright 2002-4 Sun Microsystems, Inc. 4150 Network Circle Santa Clara, CA 95054, U.S.A. All Rights Reserved.