jsf - PrimeFaces tabmenu not changing index -
i using p:tabmenu
component. have 4 menuitems, each 1 redirects different jsf page problem page returned without changing activeindex
, activeindex
remains same initial value 0.
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui"> <p:tabmenu activeindex="0"> <p:menuitem value="home" url="menu.jsf" icon="ui-icon-star"/> <p:menuitem value="fabricants" url="/pagess/pagesfabricant/fabricant.jsf" icon="ui-icon-wrench" /> <p:menuitem value="composants" url="/pagess/pagescomposant/composant.jsf" icon="ui-icon-search"/> <p:menuitem value="dossier d'equivalence" url="deq.jsf" icon="ui-icon-document"/> </p:tabmenu> </ui:composition>
how can solve problem knowing should change automatically ?
you can use el set @ managed bean level. this
<p:tabmenu activeindex="#{mybean.myactiveindex}"> <p:menuitem value="home" url="menu.jsf" icon="ui-icon-star" action="#{mybean.setactiveindex(0)}"/> <p:menuitem value="fabricants" url="/pagess/pagesfabricant/fabricant.jsf" action="#{mybean.setactiveindex(1)}" icon="ui-icon-wrench" /> </p:tabmenu>
Comments
Post a Comment