Asad Habib wrote:
> What is the best way to use result beans with Struts (i.e. beans that
> are not associated with a form). In particular, I have a plugin class
> that's called by the Struts action servlet upon startup and this class
> calculates the current date. This date needs to be stored in a bean
> having session scope and displayed on all pages in the application.
> Currently, this bean is being instantiated in one of my actions and
> placed in session scope.

Um... well, I would probably just place an instance of the "date
calculator bean" in the application scope unless you anticipate the date
being different for different users and not bother with the session
scope for something like this.

I suppose a plugin is as good a place as any to instantiate a date
calculation bean.

> Lastly, is there a design pattern that I could follow to achieve this? 

A design pattern for putting a date calculation bean into a scope? You
might be over-analyzing this ;)

> (i.e. EJB is overkill).

Ya' think?

IIRC Frank's Java WebParts has a class (filter?) that will make sure
things are put into the appropriate scope based on a set of rules (I
like filters for things like this since they're not attached to Struts)
and it beats re-inventing it like I have several times and you don't
need to use a larger framework like Spring for "mini-IoC" things.

http://javawebparts.sourceforge.net/

Dave



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

Reply via email to