Re: ViewController - session controlled beans?

2006-10-25 Thread Torsten Krah
Ok i'll try this - but init() was never called, at the first time it was
placed in its scope, but you said too that this should happen.

But i'll try your suggestion and separate things, maybe this wont be
issue anymore.

Torsten

Am Montag, den 23.10.2006, 19:22 -0700 schrieb Craig McClanahan:
 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



ViewController - session controlled beans?

2006-10-23 Thread Torsten Krah
Documentation reads - in nearly all circumsistances ... , but if i want
to have a bean in session scope for caching purposes, does
ViewController work too?
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?

Torsten



Re: ViewController - session controlled beans?

2006-10-23 Thread Craig McClanahan

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