NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

@Named vs @ManagedBean and scopes from javax.enterprise.context vs javax.faces.bean

 
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users
View previous topic :: View next topic  
Author Message
chris.bui



Joined: 11 Sep 2008
Posts: 6

PostPosted: Wed May 26, 2010 6:41 pm    Post subject: @Named vs @ManagedBean and scopes from javax.enterprise.context vs javax.faces.bean Reply with quote

I am upgrading to JSF2.0 using Netbeans 6.8, and GlassFish v3 with ICEfaces 2.0.0 Alpha 2 (1.8.2 compat).

Lots of blogs out there about @Named from javax.inject vs @ManagedBean from javax.faces.bean and scopes from javax.enterprise.context vs javax.faces.bean

When using @ManagedBean combined with any scope from the javax.faces.bean package (ie Application, Session, Request, View, etc...) deployed to GlassFish v3, I get numerous constructor/post construct calls??? Why?

If I use the @Named from javax.inject package combined with any scope from javax.enterprise.context, I get what I would expect, one call to my constructor and one call to post construct. Also, Application and Session scopes from javax.enterprise.context package behave exactly as I would expect.
1. Application lasts for the duration the GlassFish server is running
2. Session lasts for duration of a browser session.

I should mention that I do plan on using CDI in my app like @Inject annotations.

The only reason that I am trying to use @ManagedBean and scopes from javax.faces.bean package is the following:
The javax.faces.bean Java Doc states... "JSF implementations are strongly encouraged to implement this specification, as it provides significant improvements in ease of use."
Also, IceFaces uses the above mentioned style in their migration example.

Otherwise almost all blogs that I have read say to use @Named and javax.enterprise.context

If anyone has an insight I would love to hear it.

Thanks.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo