if (event.getValidationErrors() != null && event.getValidationErrors().hasErrors()) {
Component errorImage = new Image(event.getHttpRequest().getContextPath() + "/images/error.gif", "error");
Component errorMessage = new TaggedText(
this.messageSource.getMessage("message.error", null, "Error", LocaleContextHolder.getLocale()),
TaggedText.Tag.SPAN);
AjaxAction removeAction = new RemoveContentAction("onSuccessMessage");
AjaxAction replaceAction = new ReplaceContentAction("onErrorsMessage", errorImage, errorMessage);
AjaxAction effectAction = new Effect("Shake", "onErrorsMessage");
response.addAction(removeAction);
response.addAction(replaceAction);
response.addAction(effectAction);
} else {
AjaxAction removeAction = new RemoveContentAction("onErrorsMessage");
response.addAction(removeAction);
}
}