Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Difference between a PostConstruct and Constructor

843844Jun 16 2008 — edited Jun 16 2008
Is there any difference in loading the resources for a JSF page backed by a managed bean having a constructor and a JSF page backed by a managed bean having a PostConstruct?

In my managed bean I need to upload the list with some items from database. I have implemented using the Constructor that initializes this list object.
ManagedBean {
ManagedBean(){
connect to database;
upload list;
}
}
The other way is instead of using the constructor use the Javax.annotations.PostConstruct ->
ManagedBean {
@PostConstrcut
void int(){
connect to database;
upload list;
}
}
Thanks in advance.

Regards
Sandeep
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 14 2008
Added on Jun 16 2008
1 comment
6,162 views