Erro de propriedade

2 respostas
maurijava

Alguem sabe que erro é esse:

javax.el.PropertyNotFoundException: /paginas/compromisso/List2.xhtml @29,92 rendered="#{compromisso.pagingInfo.renderRemaing}": Property 'renderRemaing' not found on type br.com.mda.jsf.util.PagingInfo
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:104)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:190)
at javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:416)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:280)...

Segue os fontes:

List2.xhtml (trecho que tá dando" pau")
<h:commandLink action="#{compromisso.next}" value="Remaining #{compromisso.pagingInfo.itemCount - compromisso.pagingInfo.lastItem}"
                                       rendered="#{compromisso.pagingInfo.renderRemaing}"/>
Classe PagingInfo.java
package br.com.mda.jsf.util;

public class PagingInfo {
    private int batchSize = 5;
    private int firstItem = 0;
    private int itemCount = -1;
    
    public int getBatchSize() {
        return batchSize;
    }
    
    public int getItemCount() {
        return itemCount;
    }
    
    public void setItemCount(int itemCount) {
        this.itemCount = itemCount;
    }

    public boolean renderRemaing (){
        if (getItemCount() > getLastItem() && getLastItem() + batchSize > getItemCount()){
            return true;
        }else{
            return false;
        }

    }
    
    public int getFirstItem() {
        if (itemCount == -1) {
            throw new IllegalStateException("itemCount must be set before invoking getFirstItem");
        }
        if (firstItem >= itemCount) {
            if (itemCount == 0) {
                firstItem = 0;
            } else {
                int zeroBasedItemCount = itemCount - 1;
                double pageDouble = zeroBasedItemCount / batchSize;
                int page = (int) Math.floor(pageDouble);
                firstItem = page * batchSize;
            }
        }
        return firstItem;
    }
    
    public void setFirstItem(int firstItem) {
        this.firstItem = firstItem;
    }
    
    public int getLastItem() {
        getFirstItem();
        return firstItem + batchSize > itemCount ? itemCount : firstItem + batchSize;
    }
    
    public void nextPage() {
        getFirstItem();
        if (firstItem + batchSize < itemCount) {
            firstItem += batchSize;
        }
    }
    
    public void previousPage() {
        getFirstItem();
        firstItem -= batchSize;
        if (firstItem < 0) {
            firstItem = 0;
        }
    }

    

}

Grato por qualquer luz!

2 Respostas

renanreismartins

o faces não conseguiu encontrar a propriedade renderRemaing

note que vc tem um metodo que retorna boleano chamado renderRemaing()

porem o faces exige que vc use a convençao dos javabeans

sempre que tem uma propriedade que pode ser alterada/visualizada nomeie os metodos acessores e modificadores com get e set

getRenderRemaing()
setRenderRemaing(…)

abrassssss

maurijava

Valeu cara, funcionou redondinho :smiley:

Muito grato!

Criado 1 de fevereiro de 2011
Ultima resposta 1 de fev. de 2011
Respostas 2
Participantes 2