boolean mustRender = shouldWriteIdAttribute(component);
ResponseWriter writer = context.getResponseWriter();
assert(writer != null);
UIMessage message = (UIMessage) component;
String clientId = message.getFor();
//"for" attribute required for Message. Should be taken care of
//by TLD in JSP case, but need to cover non-JSP case.
if (clientId == null) {
if (logger.isLoggable(Level.WARNING)) {
logger.warning("'for' attribute cannot be null");
}
return;
}
clientId = augmentIdReference(clientId, component);
Iterator messageIter = getMessageIter(context, clientId, component);
assert(messageIter != null);
if (!messageIter.hasNext()) {
if (mustRender) {
// no message to render, but must render anyway
writer.startElement("span", component);
writeIdAttributeIfNecessary(context, writer, component);
writer.endElement("span");
} // otherwise, return without rendering
return;
}
FacesMessage curMessage = (FacesMessage) messageIter.next();
if (curMessage.isRendered() && !message.isRedisplay()) {
return;
}
curMessage.rendered();
String severityStyle = null;
String severityStyleClass = null;
boolean showSummary = message.isShowSummary();
boolean showDetail = message.isShowDetail();
// make sure we have a non-null value for summary and
// detail.
String summary = (null != (summary = curMessage.getSummary())) ?
summary : "";