JSF 2.2 ViewScoped

JSF 2.2 has the missing ViewScoped annotation working with CDI. Simply use @javax.faces.view.ViewScoped on your bean. Be careful NOT to mix up with @javax.faces.bean.ViewScoped.

Example view scoped class:

import javax.faces.view.ViewScoped;
import javax.inject.Named;

public class SenderView implements Serializable {

If you use the wrong annotation you will get weld errors when trying to inject an instance of the class.

Leave a Comment