1

When writing various components (specifically in this case a pop-up), there are cases where you need more customization than a <ui:param> can provide. Specifically, I'd like to be able to <ui:define> a section for a <ui:include>, or otherwise have the default, something like:

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
            xmlns:ui="http://java.sun.com/jsf/facelets">
<div class="overlay pop-up">
    <aside class="pop-up">
        <main>
            <h2>
                ${headerText}
            </h2>

            <p>${contentText}</p>
        </main>
        <div class="buttons-holder">
            <ui:insert name="button-content">
                <button class="ok">OK</button>
            </ui:insert>
        </div>
    </aside>
</div>
</ui:composition>

Where you would use it as

    <ui:include src="pop-up-ok.xhtml">
        <ui:param name="headerText" value="Please try again."/>
        <ui:param name="contentText" value="The QR code could not be scanned - please try again."/>

        <ui:define name="button-content">
            <button>Different button</button>
            <button>Another button</button>
        </ui:define>
    </ui:include>

<ui:define>/<ui:define> appears to only be supported in templates however - is there any equivalent that would provide for what I'm trying to do? Or would I have to write a full Java-based custom component?

Evan Knowles
  • 7,426
  • 2
  • 37
  • 71

0 Answers0