我正在使用 primefaces 1.1jar jsf 1.2 Richfaces 3.3.3 tomcat 7.11
我创建了xhtml页面以显示树,但在页面上显示空白。
感谢您的回复。
XHTML:可
<body>
<h:form>
<p:commandButton ></p:commandButton>
<rich:menuGroup value="#{treeBean.root}"></rich:menuGroup>
<p:tree value="#{treeBean.root}" var="node" dynamic="true">
<p:treeNode>
<h:outputText value="#{node}"/>
</p:treeNode>
</p:tree>
</h:form>
</body>
这是managedBean类
import org.primefaces.model.TreeNode;
import org.primefaces.model.*;
import org.primefaces.model.DefaultTreeNode;
public class TreeBean {
private TreeNode root;
public TreeBean() {
root = new DefaultTreeNode("Root", null);
TreeNode node0 = new DefaultTreeNode("Node 0", root);
TreeNode node1 = new DefaultTreeNode("Node 1", root);
TreeNode node2 = new DefaultTreeNode("Node 2", root);
TreeNode node00 = new DefaultTreeNode("Node 0.0", node0);
TreeNode node01 = new DefaultTreeNode("Node 0.1", node0);
TreeNode node10 = new DefaultTreeNode("Node 1.0", node1);
TreeNode node11 = new DefaultTreeNode("Node 1.1", node1);
TreeNode node000 = new DefaultTreeNode("Node 0.0.0", node00);
TreeNode node001 = new DefaultTreeNode("Node 0.0.1", node00);
TreeNode node010 = new DefaultTreeNode("Node 0.1.0", node01);
TreeNode node100 = new DefaultTreeNode("Node 1.0.0", node10);
}
public TreeNode getRoot() {
return root;
}
}
p:commandButton正在工作,我创建它只是为了测试。但是树是空白的。