Hi all- I have a session scoped backing bean which is never actually referenced in the view. It is simply used to store EJBs, which can be retrieved by my request scoped beans (which are referenced in my .xhtml files).
However, how can I actually get this session bean into the FacesContext's session scope map? Since it's never actually used on the page, it's never loaded into session.
I realize I could put a dummy variable into the session scope bean and tie it to a hidden field in the view. However, that seems really hacky...any suggestions?
Well, it's not really a backing bean if there's no view that it backs - it's just a managed bean.
On the other hand, it sounds like this is a service provider for the request-scoped beans. Specifically as a dispenser for EJBs, though I'd consider pushing the EJBs back a level and letting it provide business logic using the EJBs it's keeping.
Anyway, from that point of view, it seems reasonable that you'd want to inject it into the request backing beans, so not hackey.
If that doesn't suit, remember that there's nothing magic about session-scoped beans managed by the JSF framework compared with session-scoped beans created the old-fashioned manual way. The only difference is that JSF takes over the job of getting them instantiated.
"privilege" comes from the Latin words for "private" and "law" (legal) and dates to feudal times. To "claim privilege" meant that you were above the laws that applied to the common people.
posted 11 years ago
Thanks for the informative reply, Tim! How would I instantiate the session bean the old fashioned way? I am relatively new to JSF, and haven't instantiated them manually before.
I want my playground back. Here, I'll give you this tiny ad for it: