I have a Session scoped bean
import javax.faces.bean.SessionScoped;
import javax.inject.Named;
@Named
@SessionScoped
public class SessionBean implements Serializable{
I inyect the object in one Filter...
public class FiltroSeguridad implements Filter{
@Inject
private SessionBean sessionBean;
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest httpRequest = (HttpServletRequest) request;
sessionBean.setRutaRedirect(httpRequest.getRequestURI());
}
}
But, I inyect SessionBean in the next interaction...
@Model
public class CuentaUsuarioWebBean implements Serializable{
@Inject
private SessionBean sessionBean;
public void loginUsuario() throws IOException{
sessionBean.getRutaRedirect();
}
}
But the property getRutaRedirect()
returns null
I change the import by CDI annotations it still doesn't work (javax.enterprise.context.SessionScoped
), same with JSF annotation (javax.faces.bean.ManagedBean
and @ManagedProperty
).
Thanks.
PD: Sorry for my English!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…