File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

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: 17410

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,

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: Initialization during application start-up
It's not a secret anymore!