3 Replies Latest reply on Dec 17, 2007 12:15 PM by vipirain

    Tabpanel crazy switching

    vipirain

      Hi,

      By trying the following code, sthg strange happens. When I click the links (commandLinks, not tablinks) in the first tab, everything is fine. Whe I click the link in the second tab, it jumps again to the first tab. At some time, clicking on either link (still commandLink), just switches the tab. Is this normal behaviour?

      JSF 1.1 RI
      Tomcat 5.5
      Richfaces 3.1.0 and 3.1.2
      JDK 1.5

      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
      <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
      <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>


      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
      repeater


      <f:view>
      <a4j:form id="reloadForm">
      <rich:tabPanel>
      <rich:tab id="First" name="First" label="First">
      <a4j:htmlCommandLink>
      <h:outputText value="Link1"></h:outputText>
      </a4j:htmlCommandLink>
      </rich:tab>
      <rich:tab id="Second" name="Second" label="Second">
      <a4j:htmlCommandLink>
      <h:outputText value="Link2"></h:outputText>
      </a4j:htmlCommandLink>
      </rich:tab>
      </rich:tabPanel>
      </a4j:form>
      </f:view>



      Thanks for any help.

        • 1. Re: Tabpanel crazy switching
          vipirain

          I've seen that a lot of people looked at this post, but no one had sthg to say. So this means that you don't have this problem or you're just too busy to try it out?

          Txs for any answer.

          • 2. Re: Tabpanel crazy switching
            moldovan

            Your qeustion is not 100% clear for me, maybe i haven't understand it right.

            But, i'll try it:
            Clicking htmlcommandlink makes full page refresh, so this is normal behaviour that you switch back to the first tab.
            If you need to stay on the current tab there are 2 possibilities
            -) use a4j:commandLink and reRender content inside the tab.
            -) or set the name of the tab, where you want to stay, in your action-method of, for example, a h:commandlink an use the selectedTab-attribute

            btw: why are you using a4j:htmlCommandLink?

            • 3. Re: Tabpanel crazy switching
              vipirain

              Hi, txs for your reply.

              Yes, I want to stay on the same tab :) This is my goal.

              >> Clicking htmlcommandlink makes full page refresh, so this is normal behaviour that you switch back to the first tab.

              It would be a normal behaviour if it would always switch back to the first tab, but at some time clicking on the commandlink just switches the tab. So if I'm on the first tab and I click, I jump to the second tab, and if I'm on the sencod tab and I click the link, I jump to the first tab. Then again it stays on the same tab for a few clicks and then it starts again to switch. This can't be normal behaviour, because it's not predictable :(

              >> btw: why are you using a4j:htmlCommandLink?
              There is no special reason why I use an a4j:htmlCommandLink. It is just because in my application I have such a combination: tabs and commandlinks.

              I'll will follow your advices and surrender if someone confirms that this is normal behaviour, but I still hope it is not. Have you seen this bug report:
              http://jboss.com/index.html?module=bb&op=viewtopic&t=125992

              Perhaps it's the solution.

              Txs anyway.