01: /*
02: * Created on 6-okt-2006
03: *
04: * @author <a href="mailto:rudi.alberda@knowlogy.nl">Rudi Alberda, Knowlogy</a>
05: */
06: package nl.knowlogy.validation.jsf.renderkit;
07:
08: import java.io.IOException;
09: import java.util.Iterator;
10: import java.util.List;
11:
12: import javax.faces.component.UIComponent;
13: import javax.faces.context.FacesContext;
14: import javax.faces.context.ResponseWriter;
15:
16: /**
17: *
18: * @author <a href="mailto:rudi.alberda@knowlogy.nl">Rudi Alberda, Knowlogy</a>
19: */
20: public class FieldMessageRendererFlat extends FieldMessageRenderer {
21:
22: public void writeContent(FacesContext context,
23: UIComponent component, List errorList, boolean hasErrors)
24: throws IOException {
25:
26: ResponseWriter writer = context.getResponseWriter();
27:
28: StringBuffer errorMessages = new StringBuffer();
29: for (Iterator iter = errorList.iterator(); iter.hasNext();) {
30: String error = (String) iter.next();
31: errorMessages.append(error).append(
32: iter.hasNext() ? "<br/>" : "");
33: }
34: String errorMessage = errorMessages.toString();
35:
36: writer.write(errorMessage);
37: }
38:
39: }
|