IN JSP i used to put things in bean’s constructor which is in APPLCIATION scope,
similarly
i want to load a function upon deploy of application where i can put .
i tried putting in listener but @ that time i am not getting faces config ‘s injection .
so is there any way out ?
Tt sounds suspicious that the listener hadn’t worked for you. It should’ve worked. What I assume has happened is that you expect your request-scoped beans to get their dependencies injected outside a request/response cycle. Well, this won’t happen.
So you’d better do one of these:
@PostConstructannotation on every bean and initialize it.ServletRequestListenerwhich gets triggered on each requestIf you want a managed bean to initialize something application-wide (what is that something, btw):
application@PostConstructBtw, you have been wrong to put JSP initialization code in constructor. It should’ve been in the
init(..)method. (and actually, shouldn’t have been in a JSP at all)Alternatively you can use a
PhaseListener(in thefaces-config.xml), where to lazily load tha application settings.