title: primefaces p:tabView dynamic tabs does not close properly
body: <p>dynamically created tabs with primefaces p:tabView does not close properly.
  When I click on the tab tick to close the selected tab. Always the first tab is closed, and not the current clicked tab.
  What I want is, close the tab that was clicked. Here only the first tab is closed instead of the clicked tab.</p>
  
  <p>My JSF:</p>
  
  <pre><code>:::::::::::
  &lt;h:form prependId="false" id="form"&gt;
  
    &lt;p:tabView value="#{deneBean.tabs}" var="tab" id="myTabView" binding="#{deneBean.tabView}"&gt;  
      &lt;p:ajax event="tabClose" listener="#{deneBean.closeme(tab)}" update="@form"/&gt;
      &lt;p:tab title="#{tab.title}"  closable="true"   &gt;
        #{tab.content}
      &lt;/p:tab&gt;
    &lt;/p:tabView&gt;  
    &lt;p:commandButton value="Add Tab" action="#{deneBean.add}" update="@form" /&gt;
  
  &lt;/h:form&gt;
  :::::::::::::::::::::::
  </code></pre>
  
  <p>My Jsf Bean:</p>
  
  <pre><code>@ManagedBean
  @ViewScoped
  public class DeneBean implements Serializable {
  
    public DeneBean() {
    }
    private List&lt;NeuTab&gt; tabs;
  
    @PostConstruct
    public void init() {
        tabs = new ArrayList&lt;NeuTab&gt;();
    }
  
    public void add() {
      tabs.add(new NeuTab("tab" + tabs.size(), "some content"));
    }
  
    public void remove(NeuTab tab) {
      tabs.remove(tab);
    }
  
    public List&lt;NeuTab&gt; getTabs() {
      return tabs;
    }
  
    public boolean closeme(NeuTab tab) {
  
      for (int i = 0; i &lt; tabs.size(); i++) {
          NeuTab neuTab = tabs.get(i);
          System.out.println(i + ".list:" + neuTab.getTitle());
      }
      tabs.remove(tab);
      return true;
    }
  
    TabView tabView = new TabView();
  
    public TabView getTabView() {
      return tabView;
    }
  
    public void setTabView(TabView tabView) {
      this.tabView = tabView;
    }
    :::::::::::::::::::
  </code></pre>
  
  <p>My Class NeuTab:</p>
  
  <pre><code>    public class NeuTab {
          private String title;
          private String content;
  
          public NeuTab(String title, String content) {
              this.title = title;
              this.content = content;
          }
  
          public String getTitle() {
              return title;
          }
  
          public String getContent() {
              return content;
          }
      }
  </code></pre>