I’m not getting a postBack on my project

Asked

Viewed 82 times

0

I’m trying to do a postBack on my project only I’m not getting it.

When I submit the form it continues to select without precision. That is, it was in 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();
}

}

meuBean

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

    if (this.carro == null) {
        limpar();
    }
}

1 answer

0

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

Have you ever thought about using CDI to first load data on your page? In style:

@PostConstruct
public void inicializar() {
    modeloCarroService.buscarTodos();
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.