Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-3746

Cache resolved value of javax.faces.VALIDATE_EMPTY_FIELDS

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1.12
    • 2.0.19, 2.1.13
    • None
    • None

    Description

      In UIInput.shouldInterpretEmptyStringSubmittedValuesAsNull() the resolved value of 'javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL' is cached in the application map. It might be worth doing the same for 'javax.faces.VALIDATE_EMPTY_FIELDS' in UIInput.shouldValidateEmptyFields():

      private boolean shouldValidateEmptyFields(FacesContext context)
      {
      ExternalContext ec = context.getExternalContext();
      Boolean validateEmptyFields = (Boolean) ec.getApplicationMap()
      .get(VALIDATE_EMPTY_FIELDS_PARAM_NAME);

      if (validateEmptyFields == null)
      {
      String param = ec.getInitParameter(VALIDATE_EMPTY_FIELDS_PARAM_NAME);

      // null means the same as auto.
      if (param == null)

      { param = "auto"; }

      else

      { // The environment variables are case insensitive. param = param.toLowerCase(); }

      if (param.equals("auto") && _ExternalSpecifications.isBeanValidationAvailable())

      { validateEmptyFields = true; }
      else if (param.equals("true"))
      { validateEmptyFields = true; }

      else

      { validateEmptyFields = false; }

      // cache the parsed value
      ec.getApplicationMap().put(VALIDATE_EMPTY_FIELDS_PARAM_NAME, validateEmptyFields);
      }

      return validateEmptyFields;
      }

      Attachments

        Activity

          People

            lu4242 Leonardo Uribe
            hoersch dennis hoersch
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: