Search code examples
jsf-2selectedindexopenfaces

JSF o:tabbedPane issue changing SelectedIndex


im working with JSF 2.0 and the OpenFaces <o:tabbedPane>

im having some troubles changing the tabs.. i have an index with four jsf pages includes.

like this

<o:tabbedPane  loadingMode="client" tabGapWidth="3"  id="pestana"
                    tabClass="tab_form" rolloverTabClass="tab_form2" selectedTabClass="tab_form3"
                    tabAlignment="bottomOrRight" 
                    style="width:100%;" binding="#{GeneralBean.panelTabs}">
      <o:subPanel caption="1" styleClass="pestanas">
        <ui:include src="/datosDeLaCotizacion.jsf"/>

      </o:subPanel>
      <o:subPanel caption="2" styleClass="pestanas" disabled="true">
        <ui:include src="/datosDelProducto.jsf"/>    

      </o:subPanel>
      <o:subPanel caption="3" styleClass="pestanas" disabled="true">
          <ui:include src="/coberturas.jsf"/>

      </o:subPanel>

      <o:subPanel caption="4" styleClass="pestanas" disabled="true">
        <ui:include src="/confirmacion.jsf"/>

      </o:subPanel>
    </o:tabbedPane>

inside the jsf pages.. i have forms with their <h:commandButton> like this

<h:commandButton value="Continuar" id="botonContinuar"
                             actionListener="#{GeneralBean.continuarCotizacionPaso1}"
                             action='Forms!form.Refresh'>
            </h:commandButton> 

when its goes to the actionListener on the Bean the first time works fine... and changes the <o:tabbedPane> to the second <o:subPanel> but! when i use the <h:commandButton> of the second <o:subPanel> does not work... is not reaching the actionListener on the Bean...

Please help me if you know what im doing wrong... Thanks!


Solution

  • First, note that <o:tabbedPane> should be placed inside of a form (and I suppose that it is inside a form in your case). Second, you're mentioning that you have forms with buttons inside of JSF pages. Are these the pages that are included into <o:subPanel> of your tabbed pane?

    If so, then you actually have nested forms as a result on your page, which is not allowed. If this is true, then the solution in this case can be as easy as removing the form tags from the included sub-pages.