0

I have a ui:repeat inside a h:panelgroup, and a f:ajax outside the panel. The f:ajax click event triggers a render on the h:panelgroup. When I load the page the repeater shows my 5 items on the list. When I click the button for the first time, the h:panelgroup doubles to 10 items, every subsequent click just refreshes the first 5 items on the panel (as it should). What am I doing wrong? shouldn't the render event always just refresh the panel with the repeater in it?

BEAN:

    @ManagedBean(name = "TestBean")
    @RequestScoped
    public class TestBean {
    private List testStrings;
    public TestBean() {
    Random rn = new Random(System.currentTimeMillis());
    testStrings = Arrays.asList(rn.nextInt(),rn.nextInt(),rn.nextInt(),rn.nextInt(),rn.nextInt());
        }
    }
    public List getTestStrings() {
        return testStrings;
    }

    public void setTestStrings(List testStrings) {
        this.testStrings = testStrings;
    }

JSF:

    <h:commandButton value="Refresh">
            <f:ajax event="click" render="testPanel"></f:ajax>
    </h:commandButton>
    <p>
    <h:panelGroup id="testPanel">
            <ui:repeat var="option" value="#{TestBean.testStrings}" varStatus="status">
                    <p>
                            <h:outputText value="#{option}"></h:outputText>
                    </p>
            </ui:repeat>
    </h:panelGroup>
    </p>

I am using mojarra 2.1 I think.

Thanks.

ANSWER

The problem doesn't happen if I remove the <p>...</p> and reaplace it with <h:outputText value="#{option}"></h:outputText><br/>

casolorz
  • 8,486
  • 19
  • 93
  • 200
  • Your question would be more clear if you used the question mark `?` somewhere. ;) I couldn't reproduce the behavior you described (doubling the panelGroup content) using mojarra 2.1.8. – Elias Dorneles Jul 31 '12 at 15:02
  • Sorry I guess I wasn't very clear. I'll try a newer mojarra. – casolorz Jul 31 '12 at 15:14
  • I tried 2.1.11 and still had the same issue. – casolorz Jul 31 '12 at 15:34
  • Just realized why you couldn't reproduce it. On the code above I had `

    ....` but on my code I had `

    .....`, and if I take any of those two `

    `s out then it works fine.

    – casolorz Jul 31 '12 at 16:20

1 Answers1

0

The problem doesn't happen if I remove the <p>...</p> and reaplace it with <h:outputText value="#{option}"></h:outputText><br/>

casolorz
  • 8,486
  • 19
  • 93
  • 200