Usage of javax.inject.Named with javax.annotation.ManagedBea

UI Components for JSF
Post Reply
jee4hire
Posts: 9
Joined: 21 Oct 2011, 00:20

31 Oct 2011, 19:41

Usage of javax.inject.Named with javax.annotation.ManagedBean
Taken from the following:

http://www.primefaces.org/showcase-labs ... neMenu.jsf

Why do I have to use @ManagedBean to get it to work?
If I use just @Named it does not work? Am I causing a problem by using them both together?
What is the difference between @Named and @ManagedBean?

// PlayerConverter.java
@FacesConverter("playerConverter")
public class PlayerConverter implements Converter, Serializable {
...
}

// AutoCompleteBean.java
@SessionScoped
@Named
@ManagedBean
public class AutoCompleteBean implements Serializable {
...
}

tandraschko
PrimeFaces Core Developer
Posts: 3979
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

31 Oct 2011, 23:18

@Named and javax.enterprise.context.*Scoped should be used with CDI, @ManagedBean with plain JSF.
Thomas Andraschko

PrimeFaces | PrimeFaces Extensions

Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE

Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 46 guests