Pergunta

I am migrating application from JSF 1.2 to JSF 2.0 . I have an a4j:repeat tag for grid in JSF 1.2. As we are aware that a4j:repeat will not work in JSF 2.0, I need an alternative repeat tag. Shall I go with ui:repeat (Facelets tag) or c:forEach (JSF Core)?

Foi útil?

Solução

The <a4j:repeat> has the same lifecycle as <ui:repeat> (UI component which runs during view render time). So, when replacing 1 on 1, the <ui:repeat> is the right choice.

The <c:forEach> is a tag handler which runs during view build time. It does not appear in JSF component tree, however it participates in building it.

The difference is easily observed and understood when used inside a <h:panelGrid>. The <ui:repeat> creates a single cell which is re-rendered multiple times. The <c:forEach> creates multiple cells which is each rendered only once.

See also:

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top