You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by Apache Wiki <wi...@apache.org> on 2005/11/29 23:19:00 UTC
[Myfaces Wiki] Update of "Creating Composite Components" by SimonKitching
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Myfaces Wiki" for change notification.
The following page has been changed by SimonKitching:
http://wiki.apache.org/myfaces/Creating_Composite_Components
The comment on the change is:
Add information about using t:aliasBean and jsp:include
------------------------------------------------------------------------------
=== Tomahawk t:aliasBean and a jsp include ===
- Using a t:aliasBean and a jsp include is easy and requires only a dependency on t:aliasBean. There may be some issues with nesting t:aliasBean controls, however. You're also limited to passing a single backing bean parameter
+ Using a t:aliasBean and a jsp include is easy and requires only a dependency on t:aliasBean. There may be some issues with nesting t:aliasBean controls, however.
{{{
<t:aliasBean alias="#{localBackingBean}" value="#{thisInstanceBackingBean}">
@@ -55, +55 @@
<!-- /pages/BooleanRelationshipDataTable.jsp -->
<t:dataTable value="#{localBackingBean}" ... >
}}}
+
+ If you need to pass multiple variables to the included components, use t:aliasBeansScope instead:
+ {{{
+ <t:aliasBeansScope>
+ <t:aliasBean alias="#{localBackingBean}" value="#{thisInstanceBackingBean}"/>
+ <t:aliasBean alias="#{aLiteralString}" value="literalValue"/>
+ <f:subview>
+ <jsp:include page="/pages/BooleanRelationshipDataTable.jsp"/>
+ </f:subview>
+ </t:aliasBean>
+ }}}
+
+ Note that the f:subview is recommended but not required. It ensures that any explicit component ids in the included page won't conflict with
+ explicit component ids in the including page (because an f:subview is a NamingContainer). However because JSF lacks support for the equivalent
+ of a filesystem ".." step, a component in a subview can never reference a component in an ancestor naming container by id; components such
+ as t:dataScroller that have a "for" attribute must therefore ''not'' be nested within an f:subview. When f:subview is used, it is safe to
+ include the referenced page multiple times from an including page; when omitting the subview, this is only valid when ''all'' components
+ in the included page have automatically-assigned ids.
+
+ Note also that component binding is not supported via "aliased" names. Therefore the included page cannot include any component with a
+ "binding" attribute.
=== facelets ui:include and ui:composition ===