General purpose component metadata (JAVASERVERFACES_SPEC_PUBLIC-717)

[JAVASERVERFACES_SPEC_PUBLIC-953] Provide a way to find out if content was defined for a <ui:insert> Created: 28/Mar/11  Updated: 01/Aug/14

Status: Open
Project: javaserverfaces-spec-public
Component/s: Facelets/VDL
Affects Version/s: 2.1
Fix Version/s: None

Type: Sub-task Priority: Minor
Reporter: Jakob Korherr Assignee: Unassigned
Resolution: Unresolved Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Status Whiteboard:

size_medium importance_medium


Currently there is no way to find out (except from ugly and/or implementation-specific hacks) to find out if a user provided content for a <ui:insert name="xxx"/> or not.

Scenario: Imagine you want to provide an optional search form, which the user can define via <ui:define name="searchForm">. Then you can insert it via <ui:insert name="searchForm" />. However, what if you have to render some additional markup around the user provided search form, but you don't want to render it if the user did not provide a search form?

One very ugly workaround is to use a h:panelGroup, which you bind to a bean, use <ui:insert name="searchForm" /> as the only child and check via the binding if the h:panelGroup has any children.

It would be very nice to have an EL expression to check this stuff, or maybe to have a special facelets tag which only renders its content if a specific template is available, e.g. (note that I am not very good with names) <ui:ifTemplateAvailable name="">....<ui:insert name="xxx" /> ...</ui:...>

From the MyFaces-impl point of view, I think it is not very hard to implement.

Comment by Jakob Korherr [ 28/Mar/11 ]

or <ui:ifDefined name="xxx">...</ui:ifDefined>

Comment by Ed Burns [ 01/Aug/14 ]

Set priority to baseline ahead of JSF 2.3 triage. Priorities will be assigned accurately after this exercise.

Comment by Manfred Riem [ 01/Aug/14 ]

Setting priority to Minor

Generated at Mon Mar 27 18:50:47 UTC 2017 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.