On 6/14/07, Roger Varley <[EMAIL PROTECTED]> wrote:

On 02/06/07, Mansour <[EMAIL PROTECTED]> wrote:
> Hello every one:
> I am trying to access my business  layer from Actions. However, I need
> to hold a reference to the business layer facade and access it from any
> Actions classes. I am saving the reference to servicesFacade in a
> session and retrieving it in the Action. I am having no problem with
> this, but I don't know if this is the proper way to do it. Is there
> other alternatives ?
> I need an advice.
>

I've done a similair thing and stored a reference to the layer in the
session. However, I extended the base struts 2 action with a
layer-aware interface to get the reference to a layer and an
interceptor to inject the reference. All my actions extend the new
base class and I can retrieve the business layer with a simple
getLayer() method. This means I don't need to fiddle around with the
session object in my actions.

YMMV

Regards
Roger

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Hi,
Maybe sticking with the core j2ee patterns would be better.
As explained in the ServiceLocator pattern
http://java.sun.com/blueprints/patterns/ServiceLocator.html you maigh
associate a singleton to your servicelocator while maintaining a cache to
the already lookup()ed facades.
Best Regards.
Daoud AbdelMonem Faleh

--
http://kissthedots.blogspot.com/

"Le dieu n'est pas a craindre ; la mort ne donne pas de souci ; et tandis
que le bien est facile a obtenir, le mal est facile a supporter."

Reply via email to