Vladimir Isakovich schrieb:
Yes, I have just one call getting through to my DB, the session scoped bean with Paul's blocking method worked. The drawback with this approach, we may start thinking on cleaning session off of the unused objects, otherwise our app may consume too much cache on the server. vlad
That's why I don't utilize the JSF backing bean facility. It's not flexibly enough to maintain high dynamically applications. I've implement own session controller and it's the only backing bean I have to declare in my faces-config.xml ;) The other part of magic is application wide controller (started with ServletContextListener) to maintain some global issues and, first of all the sessions, which I catch with HTTPSessionListener.

Just a little hint: you can 'inject' your beans into session without declaring it in config.

<managed-bean>
     <managed-bean-name>MyBean</managed-bean-name>
     <managed-bean-class>my.MyClass</managed-bean-class>
     <managed-bean-scope>session</managed-bean-scope>
</managed-bean>

is equal to:

FacesContext fCtx    = FacesContext.getCurrentInstance();
ExternalContext eCtx    = _fCtx.getExternalContext();
ServletContext srvCtx  = (ServletContext)_eCtx.getContext();
HttpSession session = (HttpSession)_eCtx.getSession(false);
...
MyClass myInstance = new MyClass();
session.setAttribute("MyBean", myInstance);//put MBean to session


Reply via email to