Keep in mind with a plug-in that it is not guaranteed to run only once...
since the container is allowed to unload and reload a servlet at any time,
the plug-in would fire any time that happens.  This may or may not be a
problem for your application, but it is something to be aware of either
way.  Does this happen in practice?  I can't say I've ever seen it, I've
used plug-ins for this sort of thing as well with no problem.  I prefer
the listener though, just to avoid this possibility, no matter how remote
it may be.

Frank

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM: fzammetti
Yahoo: fzammetti
MSN: [EMAIL PROTECTED]
Java Web Parts -
http://javawebparts.sourceforge.net
Supplying the wheel, so you don't have to reinvent it!

On Thu, April 20, 2006 2:23 pm, Ted Husted said:
> The MailReader 1.3 application handles this with a plugin. The plugin
> runs once when the application starts up and seeds application scope
> with a global reference to the DAO as well as "static" data for a
> drop-down. The Shale version does this with a listener. The Action2
> version is using a listener now, but a Spring solution might be
> better.
>
> My own preference would be to use Spring to create an instant
> singleton representating whatever dataset you needed. This is also a
> good way to handle "static" utility methods, without the downside of
> static classes.
>
> HTH, Ted.
>
> On 4/20/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> wrote:
>> Hello,
>>
>> I'm looking for an elegant and simple solution to something that I'm
>> sure
>> others have dealt with already. Don't want to reinvent the wheel so I
>> thought might help to hear from others on how they're handling it.
>>
>> We have many webapps that need access to some common (mostly static)
>> data
>> for doing validations or populating dropdowns, radio buttons, etc. Some
>> examples are lists of operating companies, company locations and/or
>> company
>> holidays, etc.
>>
>> A long time ago, someone here coded a "utility" class with static
>> methods.
>> The static methods return values which are hardcoded in the code. This
>> works OK as long as the data NEVER changes. If it does, we have to
>> recompile the class and tell everyone to get the new copy of the class
>> in
>> their app.
>>
>> I thought a cleaner way would be to have a servlet that starts when the
>> webapp starts. The servlet would look up the values in some database (or
>> properties file(s)) and place the values in the app context. Initially,
>> we
>> thought about doing this at the time a user logs into the site but
>> storing
>> that info in everybody's session is inefficient.
>>
>> How have others dealt with this? Thanks for any feedback.
>>
>>
>> David
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


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

Reply via email to