jQuery in Action, 3rd edition
The moose likes JSF and the fly likes @Named and @ManagedBean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » JSF
Bookmark "@Named and @ManagedBean" Watch "@Named and @ManagedBean" New topic

@Named and @ManagedBean

Shankar sanjay
Ranch Hand

Joined: Sep 14, 2009
Posts: 117

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

Joined: Jun 25, 2001
Posts: 17030

@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.

An IDE is no substitute for an Intelligent Developer.
Brendan Healey
Ranch Hand

Joined: May 12, 2009
Posts: 218

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.

I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: @Named and @ManagedBean
jQuery in Action, 3rd edition