File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Where do Factories in Struts go? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "Where do Factories in Struts go?" Watch "Where do Factories in Struts go?" New topic
Author

Where do Factories in Struts go?

Andrew Leer
Ranch Hand

Joined: Nov 11, 2003
Posts: 44
Is there any particular place where factories, which create business deligates, in a Struts application should be initalized?

Thanks,
Andy
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Quite often in a Struts application you have objects that need to be initialized only once when the application starts up. One good way to initialize these objects is to write a class that implements org.apache.struts.action.Plugin and put the initialization code in its init() method. You would then declare this plugin class in the struts-config.xml file with a <plug-in> tag. If you do this, the Struts ActionServlet will execute your logic when it initializes.

Many developers have found this a convenient way to initialize a Hibernate Session Factory, for example.
[ September 06, 2006: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Where do Factories in Struts go?
 
Similar Threads
About Object Factories.
Abstract Factory pattern
plz solve this problem
Who does create/configure administered objects?
MDB Session multiplexing