Beispiel #1
0
  @Override
  protected void processSubmission(String elementName) {
    String value = request.getParameter(elementName);

    tracker.recordInput(this, value);

    updateClientTimeZone(elementName);

    Date parsedValue = null;

    try {
      if (InternalUtils.isNonBlank(value)) {
        // Regardless of the timeZone set on the DateFormat, the value is parsed in
        // the current default TimeZone. Use the calendar to adjust it out.

        Date inDefaultTimeZone = format.parse(value);

        parsedValue = convertDateToClientTimeZone(inDefaultTimeZone);
      }
    } catch (ParseException ex) {
      tracker.recordError(this, messages.format("tapx-date-value-not-parseable", value));
      return;
    }

    try {
      fieldValidationSupport.validate(parsedValue, resources, validate);

    } catch (ValidationException ex) {
      tracker.recordError(this, ex.getMessage());

      return;
    }

    if (min != null && parsedValue.before(min)) {
      tracker.recordError(this, messages.get("tapx-date-value-to-early"));
      return;
    }

    if (max != null && parsedValue.after(max)) {
      tracker.recordError(this, messages.get("tapx-date-value-too-late"));
      return;
    }

    this.value = parsedValue;
  }
Beispiel #2
0
  @SuppressWarnings({"unchecked"})
  @Override
  protected void processSubmission(String controlName) {
    UploadedFile uploaded = decoder.getFileUpload(controlName);

    if (uploaded != null
        && (uploaded.getFileName() == null || uploaded.getFileName().length() == 0)) {
      uploaded = null;
    }

    try {
      fieldValidationSupport.validate(uploaded, resources, validate);
    } catch (ValidationException ex) {
      validationTracker.recordError(this, ex.getMessage());
    }

    value = uploaded;
  }
Beispiel #3
0
  @SuppressWarnings({"unchecked"})
  @Override
  protected void processSubmission(String controlName) {
    String submittedValue = request.getParameter(controlName);

    tracker.recordInput(this, submittedValue);

    Object selectedValue = toValue(submittedValue);

    putPropertyNameIntoBeanValidationContext("value");

    try {
      fieldValidationSupport.validate(selectedValue, resources, validate);

      value = selectedValue;
    } catch (ValidationException ex) {
      tracker.recordError(this, ex.getMessage());
    }

    removePropertyNameFromBeanValidationContext();
  }