JSF复合组件儿童 [英] JSF composite component childrens
问题描述
有什么方法可以使用EL来检索子列表,以便我可以使用它进行遍历
Is there any way using EL to retrieve a children list so i can iterate through it with
<ul>
<ui:repeat value="#{Magic El expression}" var="children" >
<li>
<p> #{children.title} *</p>
</li>
</ui:repeat>
</ul>
<div>
<cc:insertChildren />
</div>
* perhaps #{children.attrs.title} I don't know?
我在这里想要做的是创建一个Tab复合组件.我知道诸如primefaces之类的库提供tabview等.但是由于扩展了jquery功能,我需要创建自己的库.另外,我正在使用特定的模板. 我需要获取标签标题才能创建标签列表.选项卡是子组件,无论如何我是否可以迭代并获取它们的属性?我的意思是,primefaces会以某种方式做到这一点.
What I'm trying to do here is create a Tab composite component. I know libraries such as primefaces offer tabview etc. Yet I need to create my own because of extended jquery functionality. Plus I'm working with a specific template. I need to get the tabs title to create a list for tabs. Tabs are children components is there anyway i can iterate and fetch their attributes? I mean primefaces does that somehow.
如果您查看他们的html标记,他们将创建一个无序列表,其中包含每个子级tabview组件的标题.如何实现?
If you look at their html markup they create an unordered list with the titles of each children tabview component. How is that implemented?
推荐答案
如果您显示的标记在复合组件内部(我想是),那么以下是可让您访问其子代的表达式:
If the markup you show is inside a composite component (I guess it is), then the following is the expression that will give you access to its children:
#{component.getCompositeComponentParent(component).children}
稍微相关的问题:在JSF2中,如何知道复合组件是否有子代?
这篇关于JSF复合组件儿童的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!