我是靠谱客的博主 腼腆热狗,这篇文章主要介绍Primefaces3之p:tree,现在分享给大家,希望可以做个参考。

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


我在自己项目上实现了正确的p:tree结构,先看下效果
[img]http://dl2.iteye.com/upload/attachment/0087/4218/b97492c0-8173-3462-a210-6f4aeca27b94.jpg[/img]

页面代码如下:


<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来做的,效果不错。

最后

以上就是腼腆热狗最近收集整理的关于Primefaces3之p:tree的全部内容,更多相关Primefaces3之p内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(128)

评论列表共有 0 条评论

立即
投稿
返回
顶部