1

I have a c:set variable in Java. I want to +1 to the value in a rich:dataTable, is this possible?

    <h:form id="webstoreSettings" styleClass="edit">
        <c:set var="_count" value="0" scope="page" />
        <rich:panel>
            <rich:simpleTogglePanel label="Store Properties"
                switchType="client" rendered="true">
                <div style="margin: 7px 0px;">
                    <rich:dataTable id="webListsTable"
                        value="#{storeHome.webPropertiesVars}" var="_var">
                        <h:column id="webstoreVarCol">
                            <h:outputLabel id="webstoreVar_#{_count}" value="#{_var.webstoreVar}" />
                            <c:set var="_count" value="#{_count + 1}" scope="page" />
                        </h:column>
                    </rich:dataTable>
                </div>
            </rich:simpleTogglePanel>
        </rich:panel>
    </h:form>

All of the id="webstoreVar_0" are the same :(

Thanks.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
JoJo
  • 4,643
  • 9
  • 42
  • 65

1 Answers1

3

This is not possible. JSTL tags run during view build time, not during view render time. The <rich:dataTable var> is only available during view render time.

I'm not sure why exactly you need a <h:outputLabel id> like that. It makes no sense. Just remove the EL from the id attribute. JSF will already prepend it with the row index of the data table.

<h:outputLabel id="webstoreVar" ... />

See also:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • I WISH we had JSF2... it is JSF 1.2.. one of those situations where they threw down the architecture with absolutely no plan to upgrade with new releases. – JoJo Dec 22 '12 at 13:41