• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

@Named and @ManagedBean

 
Shankar sanjay
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am using tomcat 7 to run my simple login form application.

the bean code is here.. When I use @Named annotation its not working, i am getting error like "Target Unreachable, identifier 'user' resolved to null] with root cause"

if I use @ManagedBean then its working without any issues. please help on this.

 
Tim Holloway
Saloon Keeper
Pie
Posts: 17989
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Named is CDI, @ManagedBean is JSF.

As long as you have JSF2 jars bound to your webapp, the @ManagedBean annotation will be honored.

Similarly, you have to have suitable scanning mechanisms and support classes to provide CDI functionality.

One of these days, I promise myself to find out what they are. Hopefully someone else here can tell us.
 
Brendan Healey
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I think you need to be looking at OpenWebBeans as the CDI implementation for Tomcat and there's an article here
that may be of interest: http://java.dzone.com/articles/using-apache-openwebbeans.

Glassfish uses WELD as the CDI implementation and no additional configuration should be required. If you're using
CDI one really interesting extensions package is Myfaces CODI http://myfaces.apache.org/extensions/cdi/ which
provides additional scopes (out of the box CDI doesn't have ViewScoped) and lots of other things many of which I
don't honestly fully comprehend, but @ViewAccessScoped makes it all worth it. Myfaces CODI works with Mojarra.

Regards,
Brendan.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic