In my web application I have a presentation Layer consisting of several jsf-viewscoped and some requestscoped beans. Normally I only want to have presentation logic in these, so whenever there's a task which goes beyond presentation logic, I use another Bean or an EJB. So in some viewscoped Beans I have an EJB injected. My question now is as follows : Should I avoid situations in which I have injected an EJB directly into a Bean used for presentation, by creating another (for example application scoped) bean which only delegates the method calls to the respective EJB ? And : When is the injected EJB initialized ? If it's initialized during the initialization of the bean it is injected into, then this would mean that for every visitor of my application there's always also an EJB reserved? I don't think thats the case but that EJBs are only used when one of its methods is called. But how should I separate business and presentation layers properly ?
问问题
325 次