It's not a secret anymore!*
The moose likes JSF and the fly likes @ManagedBean Annotation JSF2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "@ManagedBean Annotation JSF2" Watch "@ManagedBean Annotation JSF2" New topic
Author

@ManagedBean Annotation JSF2

Abiodun Adisa
Ranch Hand

Joined: Jan 17, 2002
Posts: 495
I am from a Seam/JSF1 Environment. I configured my Bean using annotation but could not access the class from my JSP page
the class i defined is as follows

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15950
    
  19

Well, part of your problem is that you don't access a class from a JSF View (what you called a "JSP"). You access an instance of a class.

Specifically, when you use the annotations that you illustrated, the JSF framework is going to instantiate a bean of class "Ab" and store it in your webapp's HttpSession object under the name "ab", since by default, the convention is to lower-case the class name's first character to form the instance name. That can be overridden with an annotation, but it's a reasonable naming convention.

So to refer to your bean's properties in a JSF view, you'd use the EL expression "#{ab.name}".


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: @ManagedBean Annotation JSF2
 
Similar Threads
Injection problem - not quite sure if this is something i should be using injection for
Spring 2.5.6 bean annotation validation
Issue with JPS and refreshing Entity bean's data.
JSF 2.0 Dependency injection problem
Annotations Not Working