render button according to status

0

I'm using the following code to render my button to only appear with the status Waiting for approval but does not occur.

<a4j:commandButton value="Enviar Solicitação" action="#{solicitacaoImpressaoBean.inserirSolicitacao}" 
        styleClass="espacoBotao" render="@form" rendered="#{solicitacaoImpressaoBean.peg.status.descricao  eq 'Aguardando Aprovação'}" />

Does anyone know what's wrong with the code?

    
asked by anonymous 22.11.2017 / 12:58

1 answer

0

Instead of assigning it directly like this:

rendered="#{solicitacaoImpressaoBean.peg.status.descricao  eq 'Aguardando Aprovação'}"

Create a method in Managed Bean that returns exactly that. For example:

@ManagedBean
public class SolicitacaoImpressaoBean {

    public boolean isAguardandoAprovacao() {
        return "Aguardando Aprovação".equals(peg.getStatus().getDescricao());
    }
}

And in XHTML do:

rendered="#{solicitacaoImpressaoBean.aguardandoAprovacao()}"
    
23.11.2017 / 17:52