The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.

Tuesday, October 13, 2009

Getting handle to HttpSession in ADF

However, in general you should not need to get HttpSession programmatically in ADF.

But sometimes you need and here is how:

FacesContext context = FacesContext.getCurrentInstance();

HttpSession session  = (HttpSession)context.getExternalContext().getSession()


Anonymous said...

thanks for sharing this site. there are various kinds of ebooks available from here


Prince Hippo said...


Thanks for the post!
However, I don't quite get your point: In general, you should not use get HttpSession in ADF.

Normally, we put important information in HttpSession, e.g. Login User information etc. If it's not encouraged to use get HttpSession, what could be other best way?

Thanks for your answer in advance.

Unknown said...

Edmund you are right on that. The intention behind this post is a little different and more for the beginners.

Unlike other J2EE frameworks ADF support the concept of bounded TFs where there is another scope called pageFlowScope.

So, whenever there comes a situation of passing or accessing a parameter within a TF across view activities developer tend to use session scope as view scope or request scope does not work in all the situations.