DEV Community

Orestis Pantazos
Orestis Pantazos

Posted on

🔥 JavaServer Faces Cheat Sheet

The JSF framework supports these annotations but are deprecated in JSF 2.3 and will not be used anymore.

Annotation Annotation Class
@RequestScoped javax.faces.bean.RequestScoped
@SessionScoped javax.faces.bean.SessionScoped
@ApplicationScoped javax.faces.bean.ApplicationScoped
@ViewScoped javax.faces.bean.ViewScoped
@NoneScoped javax.faces.bean.NoneScoped
@CustomScoped(value="#{someMap}") javax.faces.bean.CustomScoped

It is recommended to use JSF CDI annotations as shown in the following table:

Annotation (CDI) Annotation Class
@RequestScoped javax.enterprise.context.RequestScoped
@SessionScoped javax.enterprise.context.SessionScoped
@ApplicationScoped javax.enterprise.context.ApplicationScoped
@FlowScoped javax.faces.flows.FlowScoped
@Dependent javax.enterprise.context.Dependent

Top comments (0)