且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

是否可以在 JSF 2 中使用带有复合组件的模板?

更新时间:2023-10-11 21:51:28

这确实行不通.您需要 在实现中.

This will indeed not work. You need <ui:decorate> inside the implementation instead.

<ui:component
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:cc="http://java.sun.com/jsf/composite"
>
    <cc:interface>
        ...
    </cc:interface>
    <cc:implementation>
        <ui:decorate template="/WEB-INF/inputLayout.xhtml">
            <ui:define name="content">
                ...
            </ui:define>
        </ui:decorate>
    </cc:implementation>
</ui:component>