1
votes

When I run this the code below, Apache Tomcat Log says:

Property 'recuClientes' not found in type com.swc.rc.recu.UtilsRecu

The webPage returns No records found.

any suggestion?

This is the call

<p:outputPanel>
    <h:form>  
        <p:dataTable var="rec" value="#{rc.recu}">  
            <p:column headerText="recu">  

                <h:outputText value="#{rec.deudor}" />  


            </p:column>  
        </p:dataTable>  
    </h:form>
</p:outputPanel>

This is the source, i can use it, isnĀ“t it?

@XmlTransient
public Collection<Procs> getProcsCollection() {
    return procsCollection;
}

public void setProcsCollection(Collection<Procs> procsCollection) {
    this.procsCollection = procsCollection;
}

And this is the managedBean..

@ManagedBean(name = "rc")
@SessionScoped
public class UtilsRecu {

    private Clientes cliente=new Clientes();

    private List <Procs> recu=new LinkedList<Procs>(); 



    public void recuClientes(){

        recu=(List<Procs>) cliente.getProcsCollection();

    }        

    public void setRecu(List<Procs> recu) {

        this.recu= recu;
    }

    public List<Procs> getRecu() {
        recuClientes();
        return recu;
    }


}

Thank you..

1

1 Answers

0
votes

The exception which you're facing is not caused by the Facelets code shown so far. It's caused by incorrect usage of #{rc.recuClientes} somewhere else in the same page. Perhaps you have placed it plain vanilla in template text like so

#{rc.recuClientes}

and hoping that it would execute the method on load. But it doesn't work that way. It would be interpreted as a value expression and it would thus be looking for a getter method getRecuClientes() which returns something which can then be printed to the output. But as such a getter method does not exist, exactly the "property not found" exception would be thrown which you're facing.

Given the fact that this method performs some business logic (filling the list), it should be invoked by some action component such as <h:commandButton>.

<h:form>
    <h:commandButton value="Submit" action="#{rc.recuClientes}" />
</h:form>

Or, if you intend to invoke it during the initial GET request already, then just annotate it with @PostConstruct without the need to reference it anywhere in the view.

@PostConstruct
public void recuClientes() {
    recu = (List<Procs>) cliente.getProcsCollection();
}        

This way it will be invoked directly after bean's construction.

By the way, that cast is a code smell. In well designed code, you shouldn't have the need for that cast in this particular construct.