This Question is Answered

1 "correct" answer available (4 pts) 2 "helpful" answers available (2 pts)
11 Replies Last post: Mar 16, 2007 2:00 PM by Andy  
Andy   24 posts since
Mar 1, 2007
Currently Being Moderated

Mar 1, 2007 6:36 PM

<q:tabbedPane> Index-Exception

Hello,

 

i have a problem with the tabbedPane and the "rendered" attribute.

 

I wanted to shot a login-tab if I´m logged out and hide the others.

If i logged in i will see all othertTabs, but not the login-tab.

 

Now to my Probmen.

I i´m logged in an change the tab, so the tab Index increades to "3" and after this click on the "logout-tab" i get an error:

 

"java.lang.IndexOutOfBoundsException: Index: 3, Size: 1"

 

My code:

 


<q:tabbedPane 
                 id="tabbedPane1"
                 loadingMode="ajax" 
                 tabPlacement="top" 
                 tabAlignment="leftOrTop"
                 frontBorderStyle="1px solid gray;"
                 tabGapWidth="0"
                 styleClass="tabbedPane"
                 tabClass="tabStyle"
                 selectedTabClass="tab_active"
                 rolloverTabClass="tab_rollover"
                 containerClass="tab_container">
     <q:tabbedPaneItem rendered="#{!Login.loginSuccessful}">
          <f:facet name="tab">
               <h:outputText value="Login" styleClass="tab_name" ></h:outputText>
          </f:facet>
          <f:subview id="login">
               <jsp:include page="./login.jsp" flush="true"></jsp:include>
          </f:subview>
     </q:tabbedPaneItem>
     <q:tabbedPaneItem rendered="#{Login.loginSuccessful}">
          <f:facet name="tab">
               <h:outputText value="Vehicle Explorer" styleClass="tab_name" ></h:outputText>
          </f:facet>
          <f:subview id="vehicleExplorer">
               <jsp:include page="./tree.jsp" flush="true"></jsp:include>
          </f:subview>
     </q:tabbedPaneItem>
        ...
     <q:tabbedPaneItem rendered="#{Login.loginSuccessful}" >
          <f:facet name="tab">
               <h:commandLink value="Logout" target="./main.jsp" action="#{Login.doLogout}" styleClass="logout" ></h:commandLink>
          </f:facet>
     </q:tabbedPaneItem>
</q:tabbedPane>

 

I also tried to reset the selected index with "q_setTabbedPaneSelectedIndex(tabbedPaneId, index)" but the error is still there.

 


<h:commandLink value="Logout" target="./main.jsp" action="#{Login.doLogout}" onMouseUp="q_setTabbedPaneSelectedIndex('tabbedPane1', 0);" styleClass="logout" ></h:commandLink>

 

Is there any chance to reset the Index to "0" when i logged out before the tabbedPane is rerendered ?

 

Thanks.

Luis Roche   74 posts since
Oct 27, 2006
Currently Being Moderated
1. Mar 1, 2007 11:48 PM in response to: Andy
Re: <q:tabbedPane> Index-Exception

I'm getting a similar error when rendering items in the tabbedPane.  it is exactly the same scenario that Andy described in the previous thread.

 

java.lang.ArrayIndexOutOfBoundsException: 1

     at teamdev.jsf.component.tabbedpane.TabbedPane.processUpdates(SourceFile:596)

     at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:645)

     at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:645)

     at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:645)

     at javax.faces.component.UIForm.processUpdates(UIForm.java:87)

     at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:645)

     at javax.faces.component.UIViewRoot.processUpdates(UIViewRoot.java:157)

     at org.apache.myfaces.lifecycle.LifecycleImpl.updateModelValues(LifecycleImpl.java:302)

     at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:81)

     at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)

     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)

     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)

     at teamdev.jsf.util.ResourceFilter.doFilter(SourceFile:67)

     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)

     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)

     at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:97)

     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)

     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)

     at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)

     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)

     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)

     at org.chi.lawson.filter.SessionValidatorFilter.doFilter(SessionValidatorFilter.java:97)

     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)

     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)

     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)

     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)

     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)

     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)

     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)

     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)

     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)

     at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)

     at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)

     at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)

     at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)

     at java.lang.Thread.run(Thread.java:595)

Luis Roche   74 posts since
Oct 27, 2006
Currently Being Moderated
2. Mar 2, 2007 7:39 AM in response to: Andy
Re: <q:tabbedPane> Index-Exception

I noticed 2 things with my application. 

 

1) The tabbedPane works ok if the main pane is always rendered

2) It works if no additional components are outside the tabbedPane

 

In my case I have a dropdown box that will render the tabs based on its items.  The dropdown box is outside the tabbed pane. Item 1 will render tab 1, item 2 tab 2, etc.   The page will load correctly (rendering tab 1), but I will get the error if I select item 2, or 3, etc.

 

Now, if I move the dropdown box to the first tab and keep that one available all the time, and item 1 points to tab 2, item 2 to 3, etc, the page will load correctly and selecting the different items will render the right tab without throwing the exception. 

 

I hope this help,

 

Luis

Tatyana Matveyeva   873 posts since
Aug 16, 2006
Currently Being Moderated
3. Mar 2, 2007 6:01 PM in response to: Andy
Re: <q:tabbedPane> Index-Exception

Hello,

 

Thank you for reporting the issue. We will fix it in one of the future releases of QuipuKit.

 

You can use the following workaround until the fix is available. You can bind the "selectedIndex" attribute of the TabbedPane to the backing bean value. And when you change the "rendered" attribute for the tab, you should set this value to 0.

 

Regards,

Tatyana

Tatyana Matveyeva   873 posts since
Aug 16, 2006
Currently Being Moderated
6. Mar 5, 2007 3:25 PM in response to: Andy
Re: <q:tabbedPane> Index-Exception

Andy,

 

Here is a code from the JSP page:

 

<q:tabbedPane selectedIndex="#{Login.selectedIndex}">
  ...
  <q:tabbedPaneItem rendered="#{Login.loginSuccessful}" >
    <f:facet name="tab">
      <h:commandLink value="Logout" action="#{Login.doLogout}"></h:commandLink>
    </f:facet>
  </q:tabbedPaneItem>
</q:tabbedPane>

 

And the corresponding code from Login backing bean:

 

  
  public int mySelectedIndex = 0;

  public void setSelectedIndex(int selectedIndex) {
    mySelectedIndex = selectedIndex;
  }

  public int getSelectedIndex() {
    return mySelectedIndex;
  }

  public String doLogout() {
    mySelectedIndex = 0;
    myLoginSuccessful = false;
    return null;
  }

 

Regards,

Tatyana

Tatyana Matveyeva   873 posts since
Aug 16, 2006
Currently Being Moderated
8. Mar 13, 2007 3:53 PM in response to: Andy
Re: <q:tabbedPane> Index-Exception

Hello,

 

We've fixed this problem and the fix will be available in QuipuKit 1.1.1.

 

Regards,

Tatyana

Tatyana Matveyeva   873 posts since
Aug 16, 2006
Currently Being Moderated
10. Mar 16, 2007 1:19 PM in response to: Andy
Re: <q:tabbedPane> Index-Exception

Hello Andy,

 

Unfortunately, we were unable to reproduce your problem. According to exception you posted, the quipuKit.tld file from previous version of QuipuKit and classes from new version of QuipuKit are used in your application. Please try to clean up work and temp folders in your Tomcat and make sure, that correct version of quipuKit.tld file is used. The quipuKit.tld file is located in the META-INF folder of quipukit.jar file, and now it refers to the teamdev.jsf.taglib.tabbedpane.TabbedPaneJspTag class.

 

Regards,

Tatyana

More Like This

  • Retrieving data ...