aspose file tools*
The moose likes JSF and the fly likes Initialization during application start-up Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Initialization during application start-up" Watch "Initialization during application start-up" New topic
Author

Initialization during application start-up

Venkatesh Kumar
Ranch Hand

Joined: Aug 08, 2003
Posts: 68
Hi:

In JSF do we have something similar to Plugin interface in Struts where we can initialize resources,set values in context during application start -up.Thank you for your responses.

Thanks
Venkat Sadasivam
Ranch Hand

Joined: May 10, 2008
Posts: 139
You can write a servlet context listener. Hope the below link might help you.
http://www.onjava.com/pub/a/onjava/2001/04/12/listeners.html


“Any fool can write code that a computer can understand. Good programmers write code that humans can understand. ”<br>
-Martin Fowler
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16308
    
  22

You have a number of options. One of the simplest is to define a bean with application scope. This is actually an ideal place to hold application-wide values, since you can inject initialization values via the faces-config file without having to change the program code.

One of the things I use this for is when I have an app with dropdown lists whose items are constant values loaded from a database. I hit the server once at app startup and pass the lists back as needed. I can refer to them directly in JSF pages or inject them into session or request-scope beans.

Spring also has its uses. I use it to construct the DAOs and other persistence-layer object. By linking Spring and JSF, I can then inject these objects into the JSF objects,


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Initialization during application start-up