Java Reference
In-Depth Information
}
}
Named beans
In the earlier section, we have come across the @Named annotation. Named beans
allow us to easily inject our beans into other classes that depend on them, and to
easily refer to them from JSF pages via the Unified Expression Language ( EL ).
Recall the earlier example:
@RequestScoped
@Named
public class Customer {
private String name;
private String surname;
public String getName(){
return name;
}
public String getSurname(){
return surname;
}
}
This class, decorated with the @Named annotation, can be then referenced from a
JSF page.
Note
By default, the name of the bean will be the classname with its first letter switched
to lowercase; thus the Customer bean can be referred to as customer .
Search WWH ::




Custom Search