1

I'm developing my first JSF2 + Richfaces application and now I have this problem.

I have the following rich:tabPanel to which add and remove dynamically tab.

<h:form>
  <rich:tabPanel id="tabsPanel" switchType="ajax" activeItem="#{tabsBean.activeTab}" >
     <c:forEach var="tab" items="#{tabsBean.tabs}" styleClass="myRightPanel">
        <rich:tab  name="#{tab.name}" styleClass="myTab" >
            <h:form id="#{tab.name}" >
            <ui:include src="#{tab.pathDaIncludere}" />
        </h:form>
    </rich:tab>
   </c:forEach> 
  </rich:tabPanel>
</h:form>

but to run I must add a <h:form> around each <rich:tab> otherwise the actions in the tabs will not work.

Is correct insert <h:form> in each tab?

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
  • @Daniel that might end up being worse; I'd rather use a4j:region instead – Makhiel Feb 05 '13 at 15:00
  • Nested forms have their own issues. I suggest you remove that `h:form` from inside the tabs and change the `c:forEach` for an `a4j:repeat`. – Fritz Feb 05 '13 at 16:15
  • As @Gamb says you've nothing to do with nested forms. Use only one which surrounds the whole `tabPanel` or one for each `tab`. In the other hand I think you are bound to use `c:forEach`, as tabPanel has to know about his tags before page rendering. Related: http://stackoverflow.com/questions/4022193/is-there-a-way-to-create-dynamically-richtab-elements – Aritz Feb 05 '13 at 21:25
  • @XtremeBiker You have a point about the `c:forEach`. I take back that part of my previous comment. The OP just has to make sure that the `tabsBean.tabs` collection is properly populated with the right tabs when re-rendering (if that's the intention). – Fritz Feb 05 '13 at 21:31
  • There's no way to dynamically build it using `ui:repeat`. That's an advantage in libraries like Primefaces, where `tabView` component has a built-in iterator and you can build a model before rendering it. ``. That just avoid introducing more logic into the view. – Aritz Feb 05 '13 at 22:09

0 Answers0