You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Robert Taylor <rt...@mulework.com> on 2004/12/01 00:02:54 UTC

RE: MVC initialization

A standardized approach would be to implement a ServletContextListener and define it
in your web.xml for the web app. It will be invoked before the web app accepts any requests
and when the web app is shutdown.

A more "Struts" approach would be to use a PlugIn and define it in your struts-config.xml file.

Both of these methods provide you with bootstrapping your web app.

robert

> -----Original Message-----
> From: jeichels@optonline.net [mailto:jeichels@optonline.net]
> Sent: Tuesday, November 30, 2004 5:43 PM
> To: Struts Users Mailing List
> Subject: MVC initialization
>
>
> I know this is a bit off topic, but I figured I could get a better answer here.
>
> I am using Tomcat 4.1 and the latest production build for Struts in an MVC setup and have a large application already in
> production on the web.
>
> I need to enhance the model, but this enhancement will require me to have individual products/services register their
> interfaces with a common model hashmap.
>
> I would like this initialization to be done once at startup, but I am not sure where would be appropriate or where to do
> this.   I don't need to include any properties files or anything, just need to do some initial setup and thought that
> static blocks for each service might be a bad route?
>
> What might be a good approach for this that people who do MVC use?  I know it is a bit off topic, but though you might have ideas.
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: MVC initialization

Posted by Joe Germuska <Jo...@Germuska.com>.
At 6:02 PM -0500 11/30/04, Robert Taylor wrote:
>A standardized approach would be to implement a 
>ServletContextListener and define it
>in your web.xml for the web app. It will be invoked before the web 
>app accepts any requests
>and when the web app is shutdown.
>
>A more "Struts" approach would be to use a PlugIn and define it in 
>your 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            
Joe@Germuska.com  
http://blog.germuska.com
"Narrow minds are weapons made for mass destruction"  -The Ex