我有一个带树的tabView。 每当我加载一个标签时,primefaces会初始化所有标签。 似乎dynamic =“true”不起作用
<p:tabView id="tabView" dynamic="true" cache="true">
<p:tab id="tab1" title="1">
</p:tab>
<p:tab id="tab2" title="2">
</p:tab>
<p:tab id="tab3" title="3">
</p:tab>
<p:tab id="tab4" title="content">
<p:tree value="#{myBean.tree}" var="node" id="tree" animate="true" dynamic="true">
<p:treeNode>
stuff
</p:treeNode>
</p:tree>
</p:tab>
<p:tab id="tab5" title="5">
</p:tab>
</p:tabView>
豆
@ManagedBean
@SessionScoped
@Named(value = "myBean")
public class MyBean implements Serializable
{
private Integer activeTab;
private static final long serialVersionUID = 3915849796901858147L;
public MyBean()
{
super();
}
public Integer getActiveTab()
{
return activeTab;
}
public void setActiveTab(final Integer tab)
{
this.activeTab = tab;
}
public TreeNode getTree()
{
System.out.println("TREE");
}
}
单击选项卡后,将调用getTree方法五次 单击选项卡1:
Console
TREE
TREE
TREE
TREE
TREE
点击标签2:
Console
TREE
TREE
TREE
TREE
TREE
如果我将<p:tree>
<h:outputText>
替换为{{1}}它的作品应该如此。
有什么想法吗?
primefaces 3.5 glassfish 3.1.2