backing bean constructor is getting called twice. How to initialize it.
posted 9 years ago
Hi, I have a JSF page and a corresponding backing bean class. To initialize the html form fields within the JSF page, I wrote a piece of code to call a sateful session and get the information from the DB. However, while loading the page, backing bean constructor is getting called twice and hence session bean method is also getting called twice.
1) How can we avoid calling the session bean method more than once? 2) Is there any annotation that can be specified for a method, so that it can be called only once while loading the page? 3) I have seen somewhere saying that prerender can be used to make sure that the corresponding method gets called only once. How to specify that? Any example?