I can not do a postback in my project

0

I'm trying to make a postback in my project but I'm not getting it.

When I submit the form, it continues to do select without precision. That is, it stayed the same way

public class FacesUtil {

/**
 * Método que avalia se é postBack.
 * @return
 */
public boolean isPostback(){
    return FacesContext.getCurrentInstance().isPostback();
}

/**
 * Método que nega o PostBack
 * @return
 */
public static boolean isNotPostBack(){
    return !isNotPostBack();
}

}

MyBean

public void inicializar() {
    System.out.println("Inicializando Cadastro de Carro...");
    if(FacesUtil.isNotPostBack()){
        modeloCarros = modeloCarroService.buscarTodos();
    }

    if (this.carro == null) {
        limpar();
    }
}
    
asked by anonymous 29.03.2017 / 00:19

1 answer

0

What kind of session scope are you using? session, view, request?

Have you considered using CDI to perform a first upload of the data on your page? In Style:

@PostConstruct
public void inicializar() {
    modeloCarroService.buscarTodos();
}
    
29.03.2017 / 06:29