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.
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.
– Mario Hayasaki Júnior
I did what helped me and did not upload the information in the Selectonemenu. You can help me?
– Antonio Williams
Create the init() class by annotating @Postconstruct and calling the method to load the information, it will be called on the first screen creation.
– Mario Hayasaki Júnior