Make Global selection in the App

Asked

Viewed 19 times

0

I wanted to know how to make the selection of the global year in the application and work with the data only with the selected year. Do I have to make Managedbean Applicationscope? How do I navigate the application and not lose it in select.inserir a descrição da imagem aqui

insira o código aqui

@Named @Sessionscoped public class Gestaoanoselecaoglobal Implements Serializable { private Static final long serialVersionUID = 1L;

@Inject
private AnoSelecaos sisuAnoSelecaos;

private List<AnoSelecao> listaSisuAnoSelecaos = new ArrayList<>();

private AnoSelecao sisuAnoSelecao = new AnoSelecao();

public void todosSisuAnoSelecaos() {
    listaSisuAnoSelecaos = sisuAnoSelecaos.todas();
    System.out.println(listaSisuAnoSelecaos.size());
}

public List<AnoSelecao> getListaSisuAnoSelecaos() {
    return listaSisuAnoSelecaos;
}

public AnoSelecao getSisuAnoSelecao() {
    return sisuAnoSelecao;
}

public void setSisuAnoSelecao(AnoSelecao sisuAnoSelecao) {
    this.sisuAnoSelecao = sisuAnoSelecao;
}

}

In xhml


        <f:selectItems value="#{gestaoAnoSelecaoGlobal.listaSisuAnoSelecaos}"
            var="anoSelecao" itemValue="#{anoSelecao}"  itemLabel="#{anoSelecao.anoSelecao}" />             
    </p:selectOneMenu>

With this scope does not load the list, but using @Viewscoped works normally. You’ve had this problem?

  • Try using @Sessionscoped that once you have chosen to log in, the value will be in the session.

  • I did what helped me and did not upload the information in the Selectonemenu. You can help me?

  • Create the init() class by annotating @Postconstruct and calling the method to load the information, it will be called on the first screen creation.

No answers

Browser other questions tagged

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