Disclaimer

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()



3 comments:

Anonymous said...

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

http://feboook.blogspot.com

Prince Hippo said...

Hi,

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.
-
Edmund

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.