我正在关注复合材料组件wiki info;这是片段:
package com.example;
import javax.faces.component.FacesComponent;
import javax.faces.component.UINamingContainer;
@FacesComponent("ratingComponent")
public class RatingComponent extends UINamingContainer {
public Object[] getItems() {
Object totalStars = getAttributes().get("totalStars");
int size = Integer.valueOf(String.valueOf(totalStars));
return new Object[size];
}
}
然后它的用法:
<h:dataTable value="#{bean.products}" var="product">
<h:column>#{product.name}</h:column>
<h:column><my:rating score="#{product.rating}" /></h:column>
</h:dataTable>
taglib.xml (我正在测试) ...
<tag>
<tag-name>rating</tag-name>
<component>
<component-type>ratingComponent</component-type>
</component>
</tag>
...
我只是想知道如何让 my:rating 标记能够包含 <ui:insert/>
,这样才能使用 my:rating < / strong>以这种方式:
<my:rating score="#{product.rating}" >
<h:panelGrid border="1" columns="1" layout="block">
<h:panelGroup><label value="Lovely stars"/></h:panelGroup>
etc...
</h:panelGrid>
</my:rating>
所以我的问题是......如果组件是复合组件,如何使其可插入?
由于