I'm trying to send the value of an attribute of a managedbean called Categoria_foro from another managedbean called ControllerManagedForo, in which it is redirected to a view foro.xhtml, so that when it calls EL, Categoria_foro already has the values set. The problem is that the value is not being set
I am using JSF 2.2.9 and primefaces 6.2, this is the code
@ManagedBean(name = "controllerManagedForo")
@ViewScoped
public class ControllerManagedForo {
private String categoria_nombre;
public void buscar_foro_porCategoria() {
categoria_nombre = "something"
ExternalContext ec =
FacesContext.getCurrentInstance().getExternalContext();
ec.getRequestMap().put("categoria_nombre",
categoria_nombre);
ec.redirect("foro.xhtml");
}
}
@ManagedBean(name = "categoria_foro")
@ViewScoped
public class Categoria_foro {
private String nombre;
@PostConstruct
public void init() {
ExternalContext ec =
FacesContext.getCurrentInstance().getExternalContext();
nombre = (String) ec.getRequestMap().get("categoria_nombre");
}
}
Obviously getters and setters are defined. The attribute nombre of Categoria_foro that receives the value of the key is null, any idea of what the problem might be?