You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Sean Schofield <se...@gmail.com> on 2005/01/19 05:06:04 UTC

[shale] Question about scope of various backing beans

Craig,

I am following along with the usecases example.  Why is it that you
have a separate request scope bean logon$logic and also logon$users
(which is application-scope.)

The logon$users was all I was expecting to see.  (Also, I found it to
be a good example of how to set up application-scope beans and refer
to them in your view controllers.)

Anyways, it looks like you just have the two different beans so you
could plug another DAO into logon$logic.  It would seem that this
could be done just as easily by changing the class name of
logon$users.  Was this just an example of how properties can be
configured or do you see a real advantage to this approach?

Just curious,

sean

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: [shale] Question about scope of various backing beans

Posted by Sean Schofield <se...@gmail.com>.
> Absolutely.  Business logic and persistence logic should be packaged
> in things that are reusable outside of webapps, if you care about
> reuse across the entire enterprise.
> 
> On the other hand, if all you're ever gonna do (ya, right :-) is one
> single webapp that talks to this data, nothing stops you from writing
> JDBC calls (or whatever) into your JSF event handlers :-).

No I definitely wasn't considering that.  I have a session facade that
I used to call from my Struts actions.  Now I can make that facade a
bean with application scope and refrerence it from my backing
beans/view controllers.

The facade is thread-safe and provides access to all of my business
logic (a lot of which is now implemented in chains :-)

> Craig
 
sean

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: [shale] Question about scope of various backing beans

Posted by Craig McClanahan <cr...@gmail.com>.
There are two beans because there are two use cases:

* logon$logic contains business logic that can be used for logging
  on in *any* sort of environment ... no ties to web tier apis.  It might
  get implemented as a JavaBean or an EJB, or anything at all.

* logon$users contains cached information that is specific to its use
  in a webapp.  A more complete implementation might also have some
  mechanism to refresh its data (if it can ever change) without reloading,
  but this class is tied to JSF (and therefore web tier) APIs.

Craig


On Tue, 18 Jan 2005 23:06:04 -0500, Sean Schofield
<se...@gmail.com> wrote:
> Craig,
> 
> I am following along with the usecases example.  Why is it that you
> have a separate request scope bean logon$logic and also logon$users
> (which is application-scope.)
> 
> The logon$users was all I was expecting to see.  (Also, I found it to
> be a good example of how to set up application-scope beans and refer
> to them in your view controllers.)
> 
> Anyways, it looks like you just have the two different beans so you
> could plug another DAO into logon$logic.  It would seem that this
> could be done just as easily by changing the class name of
> logon$users.  Was this just an example of how properties can be
> configured or do you see a real advantage to this approach?
> 
> Just curious,
> 
> sean
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org