As mentioned earlier in this chapter, a backing bean (a type of managed bean) is a JavaBean that is managed by JavaServer Faces. Components in a page are associated with backing beans which provide application logic. The example backing bean, helloWorld.java, contains the following code:
package Hello;
import javax.faces.bean.ManagedBean;
@ManagedBean
public class Hello{
final String world = "Hello World!";
public String getWorld()
{ return world; }
}
The example backing bean sets the value of the world variable with the string Hello World!. The @ManagedBean annotation registers the backing bean as a resource with the JavaServer Faces implementation. For more information on managed beans and annotations, see Developing With JavaServerTM Faces Technology.