/*** Class internals ***/
private void removeOldErrors(AjaxSubmitEvent event, AjaxResponseImpl response) {
HttpServletRequest request = event.getHttpRequest();
ErrorsContainer errorsContainer = (ErrorsContainer) request.getSession(true).getAttribute(this.getErrorsAttributeName(request));
if (errorsContainer != null) {
logger.debug("Found errors for URL: " + request.getRequestURL().toString());
logger.debug("Removing old errors.");
// Remove old errors from session:
request.getSession(true).removeAttribute(this.getErrorsAttributeName(request));
// Remove old errors from HTML:
ObjectError[] errors = errorsContainer.getErrors();
for (ObjectError error : errors) {
if (this.rendersError(error)) {
ElementMatcher matcher = this.getElementMatcherForError(error);
RemoveContentAction removeAction = new RemoveContentAction(matcher);
response.addAction(removeAction);