1

I'm currently migrating a web application from JSF 1.2/Richfaces 3.3.3 to JSF 2.2 For data iteration, we used a4j:repeat from Richfaces. I now want to change the iterators to ui:repeat, because we want to throw out Richfaces.

However, I came across a very strange behaviour. Imagine a code snippet like this (simplified from the original):

<ui:repeat id="criterions" var="criterion" value="#{AdvancedSearchBean.criterionList}">
    <h:panelGroup rendered="#{criterion.searchCriterion.displayType == 'PERSON'}">
        <h:inputText value="#{criterion.searchString}"/>
    </h:panelGroup>
</ui:repeat>

The part inside the panelGroup is evaluated, although the rendered condition definitely evaluates to false. If I change ui:repeat to a4j:repeat, it works fine, the part inside the panelGroup is NOT evaluated.

This is a real problem for our code, as the "criterion" variable can contain different objects (extending the same superclass). In this case, the criterion object does not contain a property with the name "searchString" (because it is not of type "PERSON") -> an error is thrown.

Can anyone explain this behaviour or has a solution? I'm using the JSF version integrated in WildFly 8.0.0.final (Mojarra 2.2.5-jbossorg-3)

Thanks Markus

msh
  • 11
  • 4
  • 1
    you should try to use instead of "==" (see eq, ne, le ...) – djnose Jun 06 '14 at 12:39
  • @djnose `==` and `eq` do the same thing. – Makhiel Jun 09 '14 at 06:57
  • I think the rendered attribute of the panelGroup is evaluated before the ui:repeat has set the criterion variable in scope. Try replacing ui:repeat with c:forEach instead. – Edvin Syse Jun 27 '14 at 20:58
  • Did you manage to find a solution? I am stumbling upon a similar issue with jsf 2.1.29-4. Here, the ui:repeat itself is not rendered but its el expression is evaluated, which causes an exception. Changing the ui:repeat to a4j:repeat "fixes" it... – Roben Oct 20 '15 at 14:47
  • Not really. My solution is the same as yours, using a different iterator. In my case p:dataList from PrimeFaces. Works fine now. – msh Oct 21 '15 at 15:03

0 Answers0