A bit late to the party, but...
Firstly, I'd second what Joe said about PlugIns vs ServletContextListener: in more than one instance I've found that using ServletContextListener that does service/model initialization paid off when I later wanted to use the same service layer in a non-Struts web app; unless it needs to be tied to Struts, a servlet context listener has the mvc framework-neutrality benefit.
I'd also add that you might find the Spring IoC (or another IoC container such as Pico) features are worth going a step further toward making your services webapp-independent as well.
Using Spring, I configure a model layer that consists of a rich domain, orm mapper (hibernate/jdo) and, if needed, a service layer that creates a facade for app-specific behavior and to handle transaction demarcation. This setup works equally well in a Struts webapp (or any other webapp) as it does in fat clients, unit tests and scripts (scripting a Spring-configured rich domain model in grovvy is a real kick!). It's surprisingly simple to do as well.
In that way, the configuration and bootstrapping of your service and model layers are flexible and reusable outside the webapp.
- Ken
On Nov 30, 2004, at 9:00 PM, [EMAIL PROTECTED] wrote:
Thank you both much!!! I guess I will try using the ServletContextListener because I am using Servlet 2.3 as found in Tomcat 4.1. I have tried hard on staying away from having a common initilization, but the scope of the service platform I created requires the ability now...so that each product can have its own specific interface callbacks as need be. Guess this is the only way to achieve a generic platform and have specific service interfaces that sit on top.
Thank you for the help. Now I just have to figure how to implement it.
----- Original Message ----- From: Joe Germuska <[EMAIL PROTECTED]> Date: Tuesday, November 30, 2004 6:10 pm Subject: RE: MVC initialization
At 6:02 PM -0500 11/30/04, Robert Taylor wrote:webA standardized approach would be to implement a ServletContextListener and define it in your web.xml for the web app. It will be invoked before theinapp accepts any requests and when the web app is shutdown.
A more "Struts" approach would be to use a PlugIn and define ityour struts-config.xml file.
Note that the only compelling reason to use a PlugIn would be if you were still only on Servlet 2.2 (when it hadn't yet been introduced) or if you needed your PlugIn to have a reference to the ModuleConfig object corresponding to the Module in which the PlugIn was defined.
Just wanted to point out that just because it's a "more 'Struts'" approach, it's not necessarily better.
Then again, I keep writing PlugIns myself, just out of habit. They work.
Joe -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "Narrow minds are weapons made for mass destruction" -The Ex
--------------------------------------------------------------------- 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]