4
I’m having a problem using the ApplicationScoped
in JSF to save my country list.
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 far so good, debugged and the value is coming straight. The real problem is to get this value.
I tried to get through the Externalcontext and whenever I execute that code:
FacesContext.getCurrentInstance().getExternalContext().getApplicationMap().get("country");
I have as value NULL. Does anyone know why? I’m doing something wrong?
Well, thank you for your attention!