jsf - Nested b:repeat - second repeat always the same -
i want render nested 2-level navigation using model file. navigation can change.
there simple bean navigationitem contains title, target, icon , list of possible sub items.
the navigation created simple:
@viewscoped @named public class navigation implements serializable { private list<navigationitem> navigation = new arraylist<>(); public list<navigationitem> getvalues() { if (navigation == null || navigation.size() <= 0) { navigationitem nava = new navigationitem("a", "icon-gauge", "site_a"); { list<navigationitem> subnav = new arraylist<>(); subnav.add(new navigationitem("1", "", "subsite_1")); subnav.add(new navigationitem("2", "", "subsite_2")); subnav.add(new navigationitem("3", "", "subsite_3")); nava.setsubitems(subnav); } navigationitem navb = new navigationitem("b", "icon-layout", "site_b"); { list<navigationitem> subnav = new arraylist<>(); subnav.add(new navigationitem("4", "", "subsite_4")); subnav.add(new navigationitem("5", "", "subsite_5")); navb.setsubitems(subnav); } navigationitem navc = new navigationitem("c", "icon-layout", "site_c"); { list<navigationitem> subnav = new arraylist<>(); subnav.add(new navigationitem("6", "", "subsite_6")); navc.setsubitems(subnav); } navigation.add(nava); navigation.add(navb); navigation.add(navc); navigation.add(new navigationitem("test", "icon-gauge", "site_d")); } return navigation; } }
and here jsf
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:f="http://xmlns.jcp.org/jsf/core" xmlns:b="http://butterfaces.org/components" > <ul id="side-nav" class="main-menu navbar-collapse collapse"> <b:repeat value="#{navigation.values}" var="nav" rendered="true"> <li class="#{nav.hassubitems()==false ? '' : 'has-sub'}"> <h:link outcome="#{nav.target}"> <i class="#{nav.icon}"></i> <span class="title">#{nav.title}</span> </h:link> <ui:fragment rendered="#{nav.hassubitems()}"> <ul class="nav collapse"> <b:repeat value="#{nav.subitems}" var="subnav" rendered="true"> <li> <h:link outcome="#{subnav.target}"> <span class="title">#{subnav.title}</span> </h:link> </li> </b:repeat> </ul> </ui:fragment> </li> </b:repeat> </ul> </ui:composition>
my expected result:
- a
- 1
- 2
- 3
- b
- 4
- 5
- c
- 6
- d
my actual result is:
- a
- 1
- 2
- 3
- b
- 1
- 2
- 3
- c
- 1
- 2
- 3
- d
is there miss or fault? using mojarra 2.2.8 on tomcat 8
there serious issues mojarra repeat component we've created our own component in butterfaces (like primefaces, richfaces, etc.)
this seems bug , i've created issue: https://github.com/butterfaces/butterfaces/issues/63
Comments
Post a Comment