This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Initialization during application start-up" Watch "Initialization during application start-up" New topic

Initialization during application start-up

Venkatesh Kumar
Ranch Hand

Joined: Aug 08, 2003
Posts: 68

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.

Venkat Sadasivam
Ranch Hand

Joined: May 10, 2008
Posts: 139
You can write a servlet context listener. Hope the below link might help you.

“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: 15960

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:
subject: Initialization during application start-up
Similar Threads
Database connection in hibernate
When the external HTTP server will start?
Configure class in deployment jar as weblogic startup class
Thread getting lost