0 Replies Latest reply on Apr 7, 2011 6:00 AM by Lukáš Fryč

    Dynamically generated tabPanel stored in view scope

    Lukáš Fryč Master

      Hello,

       

      I have tried to create simple sample of using dynamically generated tabPanel.

      I decided to use list of strings using view scoped bean:

       

      But the sample doesn't work when list stored in view scope, otherwise it works once it is stored in session scope:

       

       

      @ManagedBean
      @SessionScoped
      public class RichBean implements Serializable {
      
      
                private List<String> list = new LinkedList<String>(Arrays.asList(new String[] {"a", "b", "c"}));
      
                public List<String> getList() {
                          return list;
                }
      
                public void add() {
                          list.add("new" + list.size());
                }
      
      
      }
      
      

       

       

      xmlns:c="http://java.sun.com/jsp/jstl/core"
      ...
      
      <h:form>
                <rich:tabPanel switchType="ajax">
                          <c:forEach items="#{richBean.list}" var="tab">
      
                                    <rich:tab label="#{tab}" id="#{tab}" name="#{tab}">
                                              Tab: #{tab}
                              </rich:tab>
      
                          </c:forEach>
                </rich:tabPanel>
      
                <h:commandButton action="#{richBean.add}" render="@form" />
      
      
      </h:form>