org.springframework.validation.BindException.getTarget()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(3.8k)|赞(0)|评价(0)|浏览(131)

本文整理了Java中org.springframework.validation.BindException.getTarget()方法的一些代码示例,展示了BindException.getTarget()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BindException.getTarget()方法的具体详情如下:
包路径:org.springframework.validation.BindException
类名称:BindException
方法名:getTarget

BindException.getTarget介绍

暂无

代码示例

代码示例来源:origin: org.springframework.boot/spring-boot

private ExceptionDetails getBindValidationExceptionDetails(Throwable rootFailure) {
  BindValidationException validationException = findCause(rootFailure,
      BindValidationException.class);
  if (validationException != null) {
    BindException target = findCause(rootFailure, BindException.class);
    List<ObjectError> errors = validationException.getValidationErrors()
        .getAllErrors();
    return new ExceptionDetails(errors, target, validationException);
  }
  org.springframework.validation.BindException bindException = findCause(
      rootFailure, org.springframework.validation.BindException.class);
  if (bindException != null) {
    List<ObjectError> errors = bindException.getAllErrors();
    return new ExceptionDetails(errors, bindException.getTarget(), bindException);
  }
  return null;
}

代码示例来源:origin: org.springframework/org.springframework.web.portlet

/**
 * Show the first page as form view.
 * <p>This can be overridden in subclasses, e.g. to prepare wizard-specific
 * error views in case of an Exception.
 */
@Override
protected ModelAndView showForm(
    RenderRequest request, RenderResponse response, BindException errors) throws Exception {
  return showPage(request, errors, getInitialPage(request, errors.getTarget()));
}

代码示例来源:origin: org.springframework/spring-webflow

/**
 * Check if the Errors instance available in given context is valid for given form object.
 */
private boolean formErrorsValid(RequestContext context, Object formObject) {
  Errors errors = getFormObjectAccessor(context).getFormErrors(getFormObjectName(), getFormErrorsScope());
  if (errors instanceof BindException) {
    BindException be = (BindException) errors;
    if (be.getTarget() != formObject) {
      if (logger.isInfoEnabled()) {
        logger.info("Inconsistency detected: the Errors instance in '" + getFormErrorsScope()
            + "' does NOT wrap the current form object '" + formObject + "' of class "
            + formObject.getClass()
            + "; instead this Errors instance unexpectedly wraps the target object '" + be.getTarget()
            + "' of class: " + be.getTarget().getClass() + ".");
      }
      return false;
    } else {
      return true;
    }
  } else {
    return true;
  }
}

代码示例来源:origin: org.springframework/org.springframework.web.portlet

String formAttrName = getFormSessionAttributeName(request);
  if (logger.isDebugEnabled()) {
    logger.debug("Setting form session attribute [" + formAttrName + "] to: " + errors.getTarget());
  request.getPortletSession().setAttribute(formAttrName, errors.getTarget());
Map referenceData = referenceData(request, errors.getTarget(), errors);
if (referenceData != null) {
  model.putAll(referenceData);

代码示例来源:origin: org.springframework/org.springframework.web.portlet

throws Exception {
if (page >= 0 && page < getPageCount(request, errors.getTarget())) {
  if (logger.isDebugEnabled()) {
    logger.debug("Showing wizard page " + page + " for form bean '" + getCommandName() + "'");
    controlModel.put(this.pageAttribute, new Integer(page));
  String viewName = getViewName(request, errors.getTarget(), page);
  return showForm(request, errors, viewName, controlModel);

代码示例来源:origin: com.asual.summer/summer-core

if (request.getAttribute(ERRORS) == null) {
  request.setAttribute(ERRORS, errors);
  request.setAttribute(be.getObjectName(), be.getTarget());
  return new ModelAndView(new InternalResourceView(form.concat(form.contains("?") ? "&" : "?").concat("_error=true")));

代码示例来源:origin: asual/summer

if (request.getAttribute(ERRORS) == null) {
  request.setAttribute(ERRORS, errors);
  request.setAttribute(be.getObjectName(), be.getTarget());
  return new ModelAndView(new InternalResourceView(form.concat(form.contains("?") ? "&" : "?").concat("_error=true")));

相关文章