The OmniFaces CDI @ViewScoped
is designed to be used with CDI managed beans, not with JSF managed beans. The @ManagedBean
creates a JSF managed bean, not a CDI managed bean. JSF managed bean facility doesn't support CDI managed bean scopes, but only JSF managed bean scopes. When no one is explicitly declared, then the default scope @RequestScoped
will actually be used.
In effects, your bean is a request scoped bean and this totally explains the symptoms you're observing.
In order to utilize the OmniFaces CDI @ViewScoped
the right way, make your bean a real CDI managed bean by replacing @ManagedBean
by @Named
.
@Named
@ViewScoped
public class ImageActionBean implements Serializable {
Unrelated to the concrete problem, starting instance variable names with an uppercase is totally against the Java naming conventions. You're effectively basically doing like this:
ImageActionBean ImageActionBean = new ImageActionBean();
This is absolutely not recommended. You should instead effectively be doing
ImageActionBean imageActionBean = ImageActionBean();
Alter the EL variables to #{imageActionBean}
accordingly.