2 Replies Latest reply on May 16, 2013 8:21 PM by Ray Yan

    a4j:repeat Hashset iteration not working

    Ray Yan Newbie

      I'm using a4j:repeat to iterate a hashset, but the var of a4j:repeat had been parsed as a set:

      Backend bean:

       

      @Named
      @ConversationScoped
      public class BankReconciliation implements Serializable {
      
      private final Set<BankStatement> statementsGroup = new HashSet<>();
      ... ...
      public Set<BankStatement> getStatementsGroup() {
                          return statementsGroup;
                }
      ... ...
      }
      

      BankStatement entity:

       

      @Entity
      public class BankStatement implements Serializable {
      private BigDecimal amount;
      ... ...
      public BigDecimal getAmount() {
                          return amount;
                }
      public void setAmount(BigDecimal amount) {
                          this.amount = amount;
                }
      
      }
      

      jsf xhtml:

       

       

      <a4j:repeat var="statement" value="#{bankReconciliation.statementsGroup}">
           <rich:panel>
                <h:outputText value="#{statement.amount}" />
           </rich:panel>
      </a4j:repeat>
      
      

      but thrown JSF EL exception:

       

      ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[FacesServlet]] (http-localhost-127.0.0.1-8080-3) Servlet.service() for servlet FacesServlet threw exception: javax.el.PropertyNotFoundException: /statements.xhtml @184,52 value="#{statement.amount}": The class 'java.util.HashSet' does not have the property 'amount'.
                at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:111) [jsf-impl-2.1.7-jbossorg-2.jar:]
                at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
                at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
                at javax.faces.component.UIOutput.getValue(UIOutput.java:169) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
                at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:205) [jsf-impl-2.1.7-jbossorg-2.jar:]
                at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:355) [jsf-impl-2.1.7-jbossorg-2.jar:]
      ... ...
      
      

      Any ideas to fix it? Thanks.