2 Replies Latest reply on Jan 13, 2008 1:01 PM by dkarr

    tabpanel thinks two tabs have the same name

    dkarr

      JSF 1.1, RichFaces 3.1.3.

      Before I file a bug report on this, I'll post this here in case I'm doing something obviously wrong.

      I have a simple tabpanel with skeleton code in each tab. Each tab has a "name" attribute with a different value. When I try to render it, I get this exception:

      javax.faces.FacesException: tabs with the same name not allowed
       at org.richfaces.renderkit.TabPanelRendererBase.encodeTabs(TabPanelRendererBase.java:328)
       at org.richfaces.renderkit.html.TabPanelRenderer.doEncodeBegin(TabPanelRenderer.java:227)
       at org.richfaces.renderkit.html.TabPanelRenderer.doEncodeBegin(TabPanelRenderer.java:180)
       at org.ajax4jsf.renderkit.RendererBase.encodeBegin(RendererBase.java:101)
       at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:683)
       at javax.faces.webapp.UIComponentTag.encodeBegin(UIComponentTag.java:591)
       at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:543)

      I stepped through this code in the debugger. My example has three tabs, with the names "obligor", "property", and "ratings". When it stepped through them, it saw the first one as "obligor", the second one as "property", and the third one as "property" (not "ratings").

      Here's my page in its current state:
      <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
      <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
      <html>
      <head>
      <title>TabPanel Experiment</title>
      </head>
      <body>
      <f:view>
       <a4j:form>
       <rich:tabPanel id="tabpanel" switchType="client">
       <rich:tab name="obligor" label="Obligor">
       <h:panelGrid columns="2" id="obligorFields">
       <h:outputText>Field1</h:outputText>
       <h:inputText id="field1"/>
       </h:panelGrid>
       </rich:tab>
       <rich:tab name="property" label="Property">
       <h:panelGrid columns="2" id="propertyFields">
       <h:outputText>Field2:</h:outputText>
       <h:inputText id="field2"/>
       </h:panelGrid>
       </rich:tab>
       <rich:tab name="ratings" label="Ratings">
       <h:panelGrid columns="2" id="ratingsFields">
       <h:outputText>Field3:</h:outputText>
       <h:inputText id="field3"/>
       </h:panelGrid>
       </rich:tab>
       </rich:tabPanel>
       </a4j:form>
      </f:view>
      </body>
      </html>


        • 1. Re: tabpanel thinks two tabs have the same name
          dkarr

          Actually, when I stepped through it, the names of tabs in order was "obligor", "property", "ratings", "property", "ratings". It added the last two twice.

          I also noted that the code doesn't actually check whether the current tab name is duplicated on any of the tabs, it's only checking whether the current tab name matches the PREVIOUS tab name. Ignoring the fact that something appears to be duplicating my tabs, if I had a sequence of tab names "a", "b", "a", I think it wouldn't even detect the error here.

          • 2. Re: tabpanel thinks two tabs have the same name
            dkarr

            Well, I'm confused. I continued to test it, and I didn't make any changes, but now it's suddenly not failing. When I step through that piece of code, the list of children looks perfectly fine now.