[OmniFaces utilities] The
containsByClassName()
method checks if the given collection contains an object with the given class name.Method:
Usage:
UIForm form = Components.getCurrentForm();
List<UIComponent>
children = form.getChildren();
Check if
at least one of the current form children is a password field:
import org.omnifaces.util.Utils;
...
boolean
isAtLeastOnePasswordFieldInForm = Utils.containsByClassName(children,
"javax.faces.component.html.HtmlInputSecret");
Check if the current form was submitted
via an UICommand of type HtmlCommandButton or HtmlCommandLink:
import org.omnifaces.util.Utils;
...
boolean wasFormSubmittedViaButtonOrLink
= Utils.containsByClassName(children,
"javax.faces.component.html.HtmlCommandButton") ?
true : Utils.containsByClassName(children,
"javax.faces.component.html.HtmlCommandLink");
Niciun comentariu :
Trimiteți un comentariu