Search code examples
javajsfprimefacesxhtmlrequired

How to set true or false in attribute required in PrimeFaces using Java code?


I would like to set in java code value in my xhtml portlet in attribut required.

I'm trying this:

  required="{portalProperties.checkRequired(foo)}"

Java code

public boolean checkRequired(String inputName) {
        if ("foo".equals(inputName))
            return true;
        else
            return false;
}

but my function doesn't invoke. Can somebody tell me how to solve my problem?


Solution

  • You are missing the hash (#) sign in front of the el expression: #{...}.