0

I have a jsf web applicationand used javax.enterprise.context.SessionScoped beans for CDI beans and websphere server. I am assuming these beans will be added to httpsession and I could retrieve them to modify or utilized in other classes. But I could not get these beans from http session, they come as Null. If I change it to javax.faces.bean.SessionScoped, it is appearing in session attributes. How to retrieve javax.enterprise.context.SessionScoped beans from http session or is there any difference how these were handled. Any help would be highly appreciated.

Let us say

Case-1:

@Named(value="webBean")
@SessionScoped //javax.enterprise.context.SessionScoped
public class WebBean{

}

I get null from httpsession.get("webBean") for the case-1.

Case-2:

@ManagedBean(value="webBean")
@SessionScoped //javax.faces.bean.SessionScoped
public class WebBean{

}

I get value from httpsession.get("webBean") for the case-2.

Thanks,

Hari

hari
  • 21
  • 5
  • If you use `javax.enterprise.context.SessionScoped` with `@ManagedBean`, you are using a wrong tutorial.... – Kukeltje Nov 30 '17 at 09:28
  • I followed this tutorial link. https://docs.oracle.com/javaee/7/tutorial/jsf-facelets003.htm. – hari Nov 30 '17 at 10:52
  • Please see my code with comments for @sessionscoped. I am not able to retrieve manually the bean which is of type CDI scope in httpsession. – hari Feb 22 '18 at 11:42

0 Answers0