0
<h:form>
    <ui:repeat value="#{sampleManagedBean.food}" var="food">
        <h:commandLink value="Name" action="#{sampleManagedBean.outcome}">
            <f:param name="name" value="ssd" />
            <f:param name="v" value="#{food.boy}" />
        </h:commandLink>
        <h2>#{food.boy}</h2>
    </ui:repeat>
</h:form> 

I can't get the the second <f:param> value which is set based on <ui:repeat var>. I can get only the first one which is hardcoded.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • 1
    look here http://stackoverflow.com/a/8759384/617373 – Daniel May 18 '12 at 05:58
  • I looked at the BaluC post about the rules of UI components and have changed the scope but i don't understand what is the other thing.We declare the list in the constructor?How do you preserve the list state while submitting? –  May 21 '12 at 09:13

2 Answers2

0

The ui:repeat is an UI component while f:param is a taghandler (like JSTL). Taghandlers run during view build time before UI components which run during view render time (see here).

In our case it means that in the view build phase f:param knows nothing about #{food.boy}. c:forEach will be fine, but if we call some kind of ajax action to change the size of
#{sampleManagedBean.food} and rerender the form, we'll not see any changes on page. Because partial rerendering (ajax) affects only UI component tree. c:forEach is somewhere between hardcoding and ui:repeat, we'll have to reload the page to see changes.

Community
  • 1
  • 1
Islam Sabyrgaliyev
  • 340
  • 1
  • 5
  • 10
0

try this way,

    <h:form>
    <ui:repeat value="#{sampleManagedBean.food}" var="food">
        <h:commandLink value="Name" action="#{sampleManagedBean.outcome}">
            <f:setPropertyActionListener value="ssd" target="#{sampleManagedBean.name}" />
            <f:setPropertyActionListener value="#{food.boy}" target="#{sampleManagedBean.v}" />
        </h:commandLink>
    </ui:repeat>
    </h:form>
Swarne27
  • 5,521
  • 7
  • 26
  • 41