ui:repeat bug in JSF 2.2

I found a strange behavior in JSF 2.2: When using the new jcp namespaces for ui:repeat it renders something like this:

<ul>
  <ui:repeat><li>a</li></ui:repeat>
  <ui:repeat><li>b</li></ui:repeat>
  <ui:repeat><li>c</li></ui:repeat>
</ul>

To get rid of this I went back to the oldĀ java.sun.com/jsf urls in the whole project and everything was working as expected.

Here is how I was able to reproduce this with glassfish4:

XHTML:

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
                template="/WEB-INF/templates/#{sessionController.template}/template.xhtml">
...
  <ul>
    <ui:repeat value="#{sessionController.testString}" var="v">
      <li>#{v}</li>
    </ui:repeat>
  </ul>
...
</ui:composition>

Controller:

@SessionScoped
@Named
@PermitAll
public class SessionController implements Serializable {
...
    public List<String> getTestString() {
        return Arrays.asList(new String[] {"a", "b", "c"});
    }
}

When I change the ui namespace to the old http://java.sun.com/jsf/facelets everything works as expected.

Leave a Reply