use of org.springframework.web.testfixture.servlet.MockPageContext in project spring-framework by spring-projects.
the class AbstractHtmlElementTagTests method exposeBindingResult.
protected void exposeBindingResult(Errors errors) {
// wrap errors in a Model
Map<String, Object> model = Collections.singletonMap(BindingResult.MODEL_KEY_PREFIX + COMMAND_NAME, errors);
// replace the request context with one containing the errors
MockPageContext pageContext = getPageContext();
RequestContext context = new RequestContext((HttpServletRequest) pageContext.getRequest(), model);
pageContext.setAttribute(RequestContextAwareTag.REQUEST_CONTEXT_PAGE_ATTRIBUTE, context);
}
Aggregations