struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daoud Abdelmonem Faleh" <abdelmonem.fa...@gmail.com>
Subject Re: facade stored in Session
Date Thu, 14 Jun 2007 13:28:06 GMT
On 6/14/07, Roger Varley <roger.varley@googlemail.com> wrote:
>
> On 02/06/07, Mansour <mansour77@yahoo.com> 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: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
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."

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message