One of the most important and useful features of JSF 2.0 consists in annotations. Based on them, JSF 2.0 provides an easy way to accomplish important tasks. In this recipe, we will present the most commonly used annotations and we will see what they can do for us.
If you are a JSF 1.2 fan, then you are familiar with the
faces-config.xml configuration file. Starting with JSF 2.0, the content of this descriptor can be partially (sometimes totally) replaced with annotations.
The most common case is represented by the managed bean, which can be annotated as shown, instead of placing a specific declaration in
import javax.faces.bean.ManagedBean; @ManagedBean public class ...