使用Primefaces 3.5创建动态菜单的递归alghoritm

时间:2016-02-21 14:54:57

标签: java jsf primefaces menuitem submenu

我需要使用Primefaces 3.5在我的jsf页面中创建一个动态菜单。 我从1个星期开始尝试建立一个递归的alghoritm,但似乎太难建立,因为时间就是力量等...... 此外,每天我都会想到一个新的alghoritm来创造这个没有好结果...... 我在Primefaces 3.5中使用JSF,我可以使用MenuItem和Submenu构建菜单栏。

PS:菜单,可能有无限的子菜单......

子菜单的我的Db表如下:

enter image description here

结果应该如下:

enter image description here

这是我的java ManagedBean:

...
MenuModel model = new DefaultMenuModel();

@PostConstruct
public void init()
{
     //I retrieve data from DB (select *)

     //I need to create my recursive alghoritm here
}

在我的Java ManagedBean中,我检索所有表数据,我需要详细说明这些数据来构建我的菜单。 构建parent_id列以链接其他项目中的当前项目。因此,如果您的parent_id不止于具有相同的值,则id等于parent_id将是子菜单。 显示为菜单的图像结果应该是......

你能帮我吗?

0 个答案:

没有答案