I\'m building a JSF+Facelets web app, one piece of which is a method that scans a directory every so often and indexes any changes. This method is part of a bean which is i
In JSF 2+ you can use a SystemEventListener
to handle it. You would set it to take action on the PostConstructApplicationEvent
to initialize it.
listeners.SystemEventListenerImpl
javax.faces.event.PostConstructApplicationEvent
The implementation would look something like :
public class SystemEventListenerImpl implements SystemEventListener {
@Override
public void processEvent(SystemEvent event) throws AbortProcessingException {
Application application = (Application) event.getSource();
//TODO
}
@Override
public boolean isListenerForSource(Object source) {
return (source instanceof Application);
}
}
This will allow you to do a lot more than just simply passing a value.