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
No comments:
Post a Comment
Feel free to leave a comment