@ManagedBean @RequestScoped public class Authenticator { private String token; public String check() { return isValid(token) ? null : "main.jsf"; } // Getter/setter. }