@Named does not work JSF

3

I'm doing a project with jsf 2 and glassfish server when I put @Named on my bean the attributes get null only works with @ManagedBean someone has already experienced this problem

    
asked by anonymous 18.08.2014 / 16:20

2 answers

4

Take a look at your import, it may be that you are using a library incorrectly or you are not importing something that is needed. Put a snippet of your code so we can help more effectively.

    
18.08.2014 / 16:43
5

This happens because the @Named annotation is part of the javax.inject package, which can be consumed by JSF but is not part of the technology itself. Use a complete Java EE Container such as GlassFish or WildFly > that already provide an implementation of the Dependency Injection for Java API ( JSR 330 ) and the CDI ( JSR 346 ) for your application. In containers such as Tomcat or Jetty you will need to make a CDI implementation available (such as Weld ). ), and, depending on the case, a Dependency Injection implementation (such as Google Guice ) manually.

    
18.08.2014 / 16:43