protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
Iterator<FacesMessage> msgIter = null;
UIRichMessage msgComponent = (UIRichMessage)component;
String forClientId = msgComponent.getFor();
if(forClientId == null){
if(log.isErrorEnabled()){
log.error("'for' attribute cannot be null");
}
}else{
msgIter = getMessageIterator(context, forClientId, msgComponent);
writer.startElement(HTML.SPAN_ELEM, msgComponent);
getUtils().writeAttribute(writer, HTML.id_ATTRIBUTE, msgComponent.getClientId(context));
if(!msgIter.hasNext() && msgComponent.isPassed()){
encodingUIContent(msgComponent, context, null);
}else if(msgIter.hasNext() ){