I'm having a problem using ApplicationScoped
on JSF to save my list of countries.
I made this managedBean:
package view.point;
import javax.faces.bean.ApplicationScoped;
import javax.faces.bean.ManagedBean;
import view.country.CountryHelper;
import model.country.Country;
@ManagedBean(eager = true)
@ApplicationScoped
public class ApplicationScope {
private Country country = CountryHelper.findAll().get(1);
public ApplicationScope() {
}
public Country getCountry() {
return country;
}
public void setCountry(Country country) {
this.country = country;
}
}
Well, so good, I debugged and the value is coming right. The real problem is to get this value.
I tried to get through ExternalContext and every time I run this code:
FacesContext.getCurrentInstance().getExternalContext().getApplicationMap().get("country");
I have NULL value. Does anyone know why? Am I doing something wrong?
Well, thanks for the attention!