【发布时间】:2015-11-06 17:03:10
【问题描述】:
我是 Java Web 新手,我只是在学习英语... 我有多个复合组件,效果很好,例如,这段代码
<composite:interface>
<composite:attribute name="usernameValue" />
</composite:interface>
<composite:implementation>
<h:form>
<h:outputText id="username" value="#{cc.attrs.usernameValue}" />
</h:form>
当我需要使用这个组件时,我只是这样做:
<myComposite:myComponent usernameValue="My user name value"/>
这工作正常。
但是,如果我需要在这个先前创建的组件中放置更多组件,该怎么办,例如:
<h:form>
<h:outputText id="username" value="My text 1" />
<p:commandButton value="New button 2"/>
<p:commandButton value="New button 3"/>
<p:commandButton value="New button 4"/>
<h:form/>
有什么办法可以做到:
<myComposite:myComponent usernameValue="This will render default inside composite output text">
<p:commandButton value="New button 1 to render inside my composite"/>
<p:commandButton value="New button 2 to render inside my composite"/>
<p:commandButton value="New button 3 to render inside my composite"/>
<myComposite:myComponent/>
我正在学习,这次我根据我将使用的组件重新创建我需要使用属性render="true or false" 的所有复合,但这就像 XGH。
对不起我的英语,我知道我需要改进它......
提前谢谢...
【问题讨论】:
标签: jsf jsf-2.2 composite-component