webtier@glassfish.java.net

JSF ajax ui:repeat re-rendering

From: Manuel <manuel_at_makumba.org>
Date: Thu, 5 Aug 2010 09:48:45 +0200

Hello,

I'm trying to re-render a whole ui:repeat using f:ajax, but don't seem
to manage.

Given the following view code:

<h:form id="f">
        <ul>
                <ui:repeat value="#{listBean.list}" var="first" id="bigList">
                        <li><h:outputText id="out" value="#{first}" /></li>
                </ui:repeat>
        </ul>
        <h:commandButton value="Go">
                <f:ajax render="f:bigList" />
        </h:commandButton>
</h:form>

with the following bean:

@ManagedBean
public class ListBean {
    static int n = 0;

    public List<Object> getList() {

        List<Object> v = new ArrayList<Object>();
        v.add(n++);
        v.add(n++);
        v.add(n++);
        return v;
}

I do get a nice response to the POST query:

<?xml version='1.0' encoding='UTF-8'?>
<partial-response><changes><update id="f:bigList"><![CDATA[
                                <li><span id="f:bigList:0:out">264</span></li>
                                <li><span id="f:bigList:1:out">265</span></li>
                                <li><span id="f:bigList:2:out">266</span></li>]]></update><update
id="javax.faces.ViewState"><![CDATA[1643660172521007289:-1929025939115594533]]></update></changes></partial-response>


However, the page is not updated. I do suspect that the <update
id="f:bigList"> can't find a "f:bigList" element on the page to
update, as ui:repeat does not render one (no span, div, or else is
rendered around the child components). I tried wrapping the ui:repeat
inside of a div that has as id "f:bigList", but that seems to mess up
things more than anything else.

Am I doing something wrong, or is this a bug?

Thanks,

Manuel