Links

   Quran Explorer - Interactive Audio Recitations & Translations

Friday, February 25, 2011

Programmatically accessing Managed Beans

Happy New Year

The traditional (best) way of accessing using managed beans is via the EL in JSF based webapps.

There are instances where u need to access a Managed Bean programaticaly (may be to avoid cyclic references in faces-config.xml thus causing deadlocks).

After so much agony I learnt how to do it and i thought of sharing it with u

FacesContext context = FacesContext.getCurrentInstance();
SessionBean bean1 = (SessionBean) context.getApplication().evaluateExpressionGet(context, "#{session}", SessionBean.class);

Of course SessionBean must already have bn declared as managed bean session in faces-config.xml

=======================================================
Artificial Intelligence is no match for Human Stupidity

OpenICE Web Framework

OpenICE - Alpha

Allow me to introduce all of you to my New Web Application Development Framework based on JSF 2.0 and powered by ICE Faces.

In OpenICE developers need not care about Managed Beans and custom POJOs since the Framework Has Robust Managed Beans which update their status and that of the application from an external XML.

The application developer will need to design, develop and manage the underlying Database (Model) and use the markup (XML) for OpenICE applications to create UI/UX elements.

In the MVC OpenICE takes care of the Control and lets the user worry about WHAT to store (Model) and WHERE to show it (View) thus cutting down development time drastically.

Footprint:
Glassfish v3
JSF 2.0
ICE Faces 2.0 using 1.8 Components