1

I am working with JSF 2.2 and I would like to build dynamic forms with jsf; this is my code:

<h:form id="myForm">
    <ui:repeat value="#{bean.list}" var="object">
        <h:panelGroup id="something#{object.id}">
            <h:commandButton value="update" action="#{bean.doSomething}">
                <f:ajax render="another#{object.id}" execute ="something#{object.id}"/>
            </h:commandButton>
        </h:panelGroup>
        <h:panelGroup id="another#{object.id}">
             <!--....-->
        </h:panelGroup>
    </ui:repeat>
</h:form>

It not working. I checked html generated and something#{object.id} is represented as :myForm:j_idt93:0:something, without object.id. For this reason not working.

I changed the h:form into ui:repeat and this solution working, but as I need update another#{object.id}, with h:form I can't point which another update.

Thank you!

2
  • Are you really saying that it doesn't work when you remove all those unnecessary #{object.id} suffixes from the ID attributes? You don't need those at all. Just use id="something" render="another" execute="something" id="another" the usual way. If that doesn't work for some reason, then the problem is caused elsewhere and you need to post a minimal reproducible example.
    – BalusC
    Nov 7, 2016 at 19:40
  • Thank you!. I used <c:forEach...> and all was perfect. Nov 7, 2016 at 20:24

0

Browse other questions tagged or ask your own question.