/** * Retrieve the Errors instance for the given bind object. * @param name name of the bind object * @param htmlEscape create an Errors instance with automatic HTML escaping? * @return the Errors instance, or {@code null} if not found */ @Nullable public Errors getErrors(String name, boolean htmlEscape) { if (this.errorsMap == null) { this.errorsMap = new HashMap<>(); } Errors errors = this.errorsMap.get(name); if (errors == null) { errors = getModelObject(BindingResult.MODEL_KEY_PREFIX + name); if (errors == null) { return null; } } if (errors instanceof BindException) { errors = ((BindException) errors).getBindingResult(); } if (htmlEscape && !(errors instanceof EscapedErrors)) { errors = new EscapedErrors(errors); } else if (!htmlEscape && errors instanceof EscapedErrors) { errors = ((EscapedErrors) errors).getSource(); } this.errorsMap.put(name, errors); return errors; }
Object target = requestContext.getModelObject(beanName); if (target == null) { throw new IllegalStateException(
optional = optional.isPresent() ? optional : getModelObject(BindingResult.MODEL_KEY_PREFIX + name);
Object target = requestContext.getModelObject(beanName); if (target == null) { throw new IllegalStateException(