jsf - I'm stuck on p:Tabmenu help please -


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.

this code on template page pages

<h:form>     <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>      </h:form> 

how can solve problem knowing should change automatically ?

i tray managed bean not work

public class loginbean {     private int activeindex=0; public int getactiveindex() {         return activeindex;     }      public void setactiveindex(int activeindex) {         this.activeindex = activeindex;     }       public void dirige(int a){         activeindex=a;    }}..    <p:tabmenu activeindex="#{loginbean.activeindex}" >          <p:menuitem value="home" url="menu.jsf" icon="ui-icon-star"  action="#{loginbean.dirige(0)}"/>           <p:menuitem value="fabricants" url="/pagess/pagesfabricant/fabricant.jsf" icon="ui-icon-wrench" action="#{loginbean.dirige(1)}"/>     </p:menuitem> 

also not working

i try add update="@all" everu menuitem .it same :(


i forget tell .this component on template page ..all page using template !!! problem when page charged on braowser take property of template , on template code

<h:form>     <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>      </h:form> 

it shows active index on 0 ,for thing page redirected not synchronize active index .. there solotion please

i think possible update component tree inside action method.

you can modify components dynamicly inside action methods , set active index likewise.

here tabmenu component api further references.

http://www.primefaces.org/docs/api/3.5/org/primefaces/component/tabmenu/tabmenu.html

public void getfooclientid(int activeindex) {     facescontext context = facescontext.getcurrentinstance();     uiviewroot root = context.getviewroot();      final string componentid = "foo";     uicomponent c = findcomponent(root, componentid);     tabmenu t = (tabmenu)c;     t.setactiveindex(activeindex);     }    /**    * finds component given id    */   private uicomponent findcomponent(uicomponent c, string id) {     if (id.equals(c.getid())) {       return c;     }     iterator<uicomponent> kids = c.getfacetsandchildren();     while (kids.hasnext()) {       uicomponent found = findcomponent(kids.next(), id);       if (found != null) {         return found;       }     }     return null;   } 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -