I have a question. I have been using JSF2.0 these days and I found to use annotation rather than faces-config.xml
to configure managed bean is more useful. But I am facing a problem to get the managed bean instance in my *.xhtml pages.
While I am using faces-config.xml
to declare my managed bean I do it like:
<managed-bean>
<managed-bean-name>exampleBean</managed-bean-name>
<managed-bean-class>com.example.ExampleBean</managed-bean-class>
<managed-bean-scope>view</managed-bean-scope>
</managed-bean>
But with annotation we do it like: @ManagedBean(name = "exampleBean")
.
But while accessing the managed bean in EL expression and its property using annotation, I can't get the instance of the managed bean. I keep trying the #{}
and ctrl+space
in Eclipse but does not come in suggestion.
But its easier to get the instance while using faces-config.xml
to declare the managed bean. How can I do this using annotation as well?
Please suggest!! Thanks in advance.. :)