aspose file tools*
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
Author

@Named and @ManagedBean

Shankar sanjay
Ranch Hand

Joined: Sep 14, 2009
Posts: 117
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

Joined: Jun 25, 2001
Posts: 16228
    
  21

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


Customer surveys are for companies who didn't pay proper attention to begin with.
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.

Regards,
Brendan.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: @Named and @ManagedBean