Forums Register Login

@Named and @ManagedBean

+Pie Number of slices to send: Send
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.

+Pie Number of slices to send: Send
@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.
+Pie Number of slices to send: Send

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.
The overall mission is to change the world. When you've done that, then you can read this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1338 times.
Similar Threads
Error
How to keep variable value alive in JSF
EntityManager is null when I try to use it straight from filter servlet
Value doesnt return when I use @Named annotation in JSF2 but @ManagedBean working fine.
Why @ManagedBean works while @Named doesn't?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 04:12:53.