Primefaces tabview tabChange event fired after displaying tab

前端 未结 3 1186
南方客
南方客 2021-01-14 03:31

I am working on a project using Primefaces 3.5 & JSF2.1 (Mojarra)

I have created a primefaces wit

3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-14 03:59

    It work fine in Primefaces 3.5 and mojarra 2.1.20, my code: bean:

    @ManagedBean(name = "tabview")
    @ViewScoped    
    public class TabView implements Serializable {
    
            private static final long serialVersionUID = 1L;
            private List l1;
            private List l2;
            private List l3;
    
            public TabView() {
                l1 = new ArrayList();
                l2 = new ArrayList();
                l3 = new ArrayList();
    
                Car c1 = new Car("c1", "a1");
                Car c2 = new Car("c21", "a21");
                Car c3 = new Car("c31", "a31");
                Car c4 = new Car("c41", "a41");
                Car c5 = new Car("c51", "a51");
                Car c6 = new Car("c61", "a61");
                Car c7 = new Car("c71", "a71");
                Car c8 = new Car("c81", "a81");
                Car c9 = new Car("c91", "a91");
                l1.add(c1);
                l1.add(c2);
                l1.add(c3);
    
                l2.add(c4);
                l2.add(c5);
                l2.add(c6);
    
                l3.add(c7);
                l3.add(c8);
                l3.add(c9);
            }
    
            public void hand(TabChangeEvent event) {
                Car c1 = new Car("c1", "a1");
                Car c2 = new Car("c1", "a1");
                Car c3 = new Car("c1", "a1");
                Car c4 = new Car("c1", "a1");
                Car c5 = new Car("c1", "a1");
                Car c6 = new Car("c1", "a1");
                Car c7 = new Car("c1", "a1");
                Car c8 = new Car("c1", "a1");
                Car c9 = new Car("c1", "a1");
                l1.add(c1);
                l1.add(c2);
                l1.add(c3);
    
                l2.add(c4);
                l2.add(c5);
                l2.add(c6);
    
                l3.add(c7);
                l3.add(c8);
                l3.add(c9);
            }
    
            public List getL1() {
                return l1;
            }
    
            public void setL1(List l1) {
                this.l1 = l1;
            }
    
            public List getL2() {
                return l2;
            }
    
            public void setL2(List l2) {
                this.l2 = l2;
            }
    
            public List getL3() {
                return l3;
            }
    
            public void setL3(List l3) {
                this.l3 = l3;
            }
        }
    

    xhtml:

        
                        
                        
                            
                                #{l1.manufacturer}
                                #{l1.model}
                            
                        
                        
                            
                                #{l2.manufacturer}
                                #{l2.model}
                            
                        
                        
                            
                                #{l3.manufacturer}
                                #{l3.model}
                            
                        
                    
    

提交回复
热议问题