`

Primefaces3之p:tree

    博客分类:
  • JSF
阅读更多
   使用primefaces3做JSF页面的开发,在使用p:tree的时候,发现官网和文档都有问题,按照文档并不能做出正确的树结构,会有一种"Type is not string"的错误,具体的忘记了。


   我在自己项目上实现了正确的p:tree结构,先看下效果


   页面代码如下:
<h5>Menu</h5>
<p:tree dynamic="true" value="#{rightTreeBean.root}" style="..." var="data" id="tree">
     <p:treeNode id="treeNode" icon="..."> 
        <h:outputText value="#{data}" style="..."/>
     </p:treeNode>  
     <p:treeNode id="treeNodeIBM" type="IBM" icon="..."> 
        <h:outputText value="#{data}" style="..."/>
     </p:treeNode>
     <p:treeNode id="treeNodeNOKIA"  type="NOKIA" icon="..."> 
        <h:outputText value="#{data}" style="..."/>
     </p:treeNode>
     <p:treeNode id="treeNodeAPPLE" type="APPLE" icon="..."> 
        <h:outputText value="#{data}" style="..."/>
     </p:treeNode>                                    
</p:tree>


  后台的JAVA代码
public RightTreeBean(){
   root = new DefaultTreeNode("Root", null);
   TreeNode orgNode = new DefaultTreeNode("Test", root);
		
   TreeNode templdateNode = new DefaultTreeNode("IBM","IBM",orgNode);
   TreeNode vmsNode = new DefaultTreeNode("NOKIA","NOKIA", orgNode);
   TreeNode appNode = new DefaultTreeNode("APPLE","APPLE", orgNode);
}


  每一个TREE左边的图片是用icon来做的,效果不错。
  • 大小: 6 KB
分享到:
评论
2 楼 wxynxyo 2017-12-13  
上善若水_Happy 写道
你好,想请教下icon的css是怎么写的?


少年,都是很多年前的,忘记了,你可以看下官网上面的教程。
1 楼 上善若水_Happy 2017-11-15  
你好,想请教下icon的css是怎么写的?

相关推荐

Global site tag (gtag.js) - Google Analytics