Please ignore - sent to wrong forum accidentally.
Naresh
-----Original Message-----
From: Naresh Bhatia
Sent: Thursday, December 07, 2006 1:21 PM
To: 'Maven Users List'
Subject: When to initialize bean properties?
I have a bean property that is displayed on a page. The value of the
property needs to be initialized by making a service layer call. When
should this initialization be done? Currently I am doing a lazy
initialization when the property is first accessed:
public class ForumDetailsBean {
private ForumDetailsVO forum;
public ForumDetailsVO getForum() {
if (forum == null) {
forum = forumService.getForumDetails(forumId);
}
return forum;
}
public void setForum(ForumDetailsVO forum) {
this.forum = forum;
}
}
In other component frameworks I have used (e.g. asp.net), such
initialization is done on page load events. What is the recommended JSF
way? (BTW, my bean is in request scope).
Naresh
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]