Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

Re: [s2] implement Parameterizable versus ServletContextListener versus another solution

Don Brown

2006-12-27

Replies:

I think the best solution is to keep business code like that out of
Struts actions and even away from the Struts framework altogether.
Personally, I'd use Spring to manage my services, then use the
property placeholder to inject String constants into my services using
a properties file. In the most simple case, have your service class,
which sends the email, look for a "/email.properties" file on the
classpath and load it in your constructor.

Don

On 12/27/06, Wesley Wannemacher <WesW@(protected):
> Hello,
>
> Seeking some advice...
>
> I am hoping to create a standard method for passing configuration
> snippets to Actions. For instance, let's say I have a method that among
> other things, sends an email message. I don't want to hard-code which
> email server I am planning on using, so how do I tell the Action that I
> want to use serverX? I figure that whatever I do now, I'll be
> copying/pasting (if not extending) in the future, so what would be the
> best method, or what are you guys doing?
>
> --
> Wes Wannemacher
> Double A Trailer Sales, Inc.
> wesw@(protected)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.