protected static String render ( final WebComponent component ) { StringWriter stringWriter = new StringWriter ( ) ; PrintWriter printWriter = new PrintWriter ( stringWriter ) ; component . paint ( new WebXmlRenderContext ( printWriter ) ) ; printWriter . flush ( ) ; String content = stringWriter . toString ( ) ; return content ; }
Renders the given component to a web - XML String and returns it . This occurs outside the context of a Servlet .