On 10/23/06, Torsten Krah <[EMAIL PROTECTED]> wrote:
Documentation reads - in nearly all circumsistances ... , but if i want to have a bean in session scope for caching purposes, does ViewController work too?
No, this does not work ... init() is called only when the corresponding bean is first placed into its relevant scope. So, a session scoped view controller bean is only going to have init called once. I ask because my init method does not get called when using a session
scoped bean which implements ViewController, should it call the methods or not?
My recommendation would be to think about the data you need to cache, and the event handlers relevant to a particular page, as two separate things. The former can go into a regular session scoped managed bean (or, you can extend AbstractSessionBean if that bean itself needs to know about session related events), and keep your event handlers in a standard ViewController managed bean in request scope. One advantage to this split that you should appreciate is it becomes much easier to write unit tests for your session-scoped data bean ... it does not require any Shale or JSF APIs, so it's much simpler to set up a test environment for it. Torsten
Craig