There are three ways to do this that I have successfully used.
#1) Programmically create a set of controls as a new component.
#2) Use x:aliasBean and a jsp include to represent your composite control.
#3) Use ui:composition with the facelets library.
#1 is the hardest, most involved, and most fragile way to do it.
#2 is easy and requires only a dependency on x:aliasBean. There are
possibly some issues with nesting x:aliasBean controls, however.
#3 is also easy and requires a dependency on the facelets library.
The resulting code for #2 and #3 are very similar, and converting
between them is trivial in most cases.
Shale's Clay subproject probably also offers similar functionality,
but I haven't used it yet.
You can find an example of #1 in issue MYFACES-331:
http://issues.apache.org/jira/secure/attachment/12311217/RowAndColumnRelationshipComponent.zip
An example of using #2 (without the custom component code) would look like this:
<x:aliasBean alias="#{backingBean}"
value="#{activityTypeCategoryActivityTypeListRelationshipDataBackingBean}">
<f:subview
id="activityTypeCategoryActivityTypeListRelationshipDataDataTableView">
<jsp:include page="/pages/BooleanRelationshipDataTable.jsp"/>
</f:subview>
</x:aliasBean>
An example of use #3 (without the custom component code) would look like this:
<ui:include src="/pages/BooleanRelationshipDataTable.xhtml">
<ui:param name="backingBean"
value="#{activityTypeCategoryActivityTypeListRelationshipDataBackingBean}"/>
</ui:include>
-Mike
On 7/28/05, Dennis Byrne <dennis@dbyrne.net> wrote:
> I can't seem to find a lot of resources on creating composite
> controls ( an .ascx in .NET speak ). Does anyone have a web
> site or a war story for this?
> Dennis Byrne
>
|