Cache some information while server startup
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Lakshmanan_Dharmalingam
Posted On:   Thursday, December 27, 2007 04:10 AM

I am doing POC on JSF. I want to cache some information at application level while server startup. Can any one plese help me regards this.

Re: Cache some information while server startup

Posted By:   praveen_soni  
Posted On:   Tuesday, January 8, 2008 06:01 PM

Before answering your question, some background: A JSF based applicaion still have servlets and JSP at the back of it. If you are familiar with doing this with ordinary JSP/Servlet based application, you do the same with JSF based application.
Simplest solution would be do define a servlet which loads at server startup(there is a setting in web.xml to load a servlet at startup) and in its init() method intialize a bean with the data you want to cache and put that bean in application context.
Later you can use this application scoped bean in your JSF managed beans, in normal way you would access any application scoped bean.
Hope this helps
About | Sitemap | Contact