English 中文(简体)
• 如何动态生成: 零件?
原标题:How dynamically generate ace:tabPane components?

I am using JSF 2.1 and ICEFaces 2 and I have a tabset like:

<ace:tabSet clientSide="true">
    <ace:tabPane>
        <f:facet name="label">My First Tab</f:facet>
        <h:outputText value="One"></h:outputText>
    </ace:tabPane>
    <ace:tabPane>
        <f:facet name="label">Second Tab</f:facet>
        <h:outputText value="Two"></h:outputText>
    </ace:tabPane>
    <ace:tabPane>
        <f:facet name="label">Third Tab</f:facet>
        <h:outputText value="Third"></h:outputText>
    </ace:tabPane>
</ace:tabSet>

我不想硬化刺刀,而是想根据一份清单来动态地制作。 我如何能够通过标准的联合论坛或ICEFace部分实现这一目标?

我尝试使用<代码><ui:repeat>,但并不工作:

<ui:repeat var="o" value="#{bean.myList}" varStatus="status">
    <ace:tabPane>
        <f:facet name="label">#{o.name}</f:facet>
        <h:selectManyCheckbox value="#{o.valuesArray}" layout="pageDirection">
            <f:selectItems value="#{o.checkboxes}" />
        </h:selectManyCheckbox>
    </ace:tabPane>
</ui:repeat>
最佳回答

I don t do ICEFaces, but you re encountering basically the same problem as RichFaces has with its <rich:tab>. As there exist no hypothetical <rich:tabs> (like as <rich:columns> which would be the dynamic variant of <rich:column>/<h:column>), one would have to use the view build time JSTL <c:forEach> tag to prepare the JSF view with those tags. You could apply the same on your ICEFaces page:

<ace:tabSet clientSide="true">
  <c:forEach items="#{bean.tabs}" var="tab">
    <ace:tabPane>
      <f:facet name="label">#{tab.label}</f:facet>
      <h:outputText value="#{tab.name}"></h:outputText>
    </ace:tabPane>
  </c:forEach>
</ace:tabSet>

请注意,只有<代码>#{bean}不是真正管理的星号,而这一表述又取决于对另一个共同养恤基金组成部分的评价,例如<代码><h:数据 表 var=“bean”>。

The <ui:repeat> found t work as it s a full-time tag. 在建立共同未来论坛组成部分的树木之前,它就能够生动地产生多种共同未来基金组成部分。

See also:

问题回答

i 认为你可以这样写:

<ice:panelTabSet var="tab" value="#{mainTabsTempl.tabs}">
    <ice:panelTab label="#{tab.label}">
         body
    </ice:panelTab>
</ice:panelTabSet>

它不是tabSet tag,但也有同样的工作。





相关问题
JSF a4j:support with h:selectManyCheckbox

I m having trouble with a JSF selectManyCheckbox and A4J support. The purpose is to run some action when a checkbox is selected. This works perfectly in Firefox. Yet, when testing in any IE (ie6 / ie7 ...

Mojarra for JSF Encoding

Can anyone teach me how to use mojarra to encode my JSF files. I downloaded mojarra and expected some kind of jar but what i had downloaded was a folder of files i don t know what to do with

如何拦截要求终止?

在共同基金中,如果用户要求终止,就需要采取一些行动。 我需要某种拦截器,但我不知道如何这样做。 我需要帮助。 增 编

ICEFaces inputFile getting the file content without upload

Is there any way of just getting the content of the browsed file without any upload/file transfer operations? I currently use ICEFaces inputFile component but I do not need the default uploading ...

Weird behaviour of h:commandLink action (MethodExpression)

I have two JSPs where I am displaying some info from database in a h:dataTable. One of them is showing all the info, and one of them user specifically. I have showXML.jsp that shows the "XML" column ...

How to correctly use ResultSet with h:dataTable

The problem is, that after displaying the ResultSet with <h:dataTable>, the connection is left open. If I close it, it closes the ResultSet too. I m thinking about copying the ResultSet data ...

热门标签