}
private void renderErrorMessage(AjaxActionEvent event, AjaxResponse response, String messageCode, String defaultMessage) {
// If errors occur, render an error message with a proper icon:
String message = this.messageSource.getMessage(messageCode, null, defaultMessage, LocaleContextHolder.getLocale());
Image img = new Image(event.getHttpRequest().getContextPath() + "/images/error.gif", "error");
TaggedText txt = new TaggedText(message, TaggedText.Tag.SPAN);
// Put the message in its proper web page space:
ReplaceContentAction action1 = new ReplaceContentAction("message", img, txt);
// Shake the message:
Effect action2 = new Effect("Shake", "message");