public class HtmlTable extends AbstractControl { ... public String toString() { int estimatedControlSize = 1000; HtmlStringBuffer buffer = new HtmlStringBuffer(estimatedControlSize); // Rendering Start buffer.elementStart("table"); appendAttributes(buffer); buffer.elementClose(); renderRows(buffer); buffer.closeElement("table"); // Rendering End return buffer.toString(); } }to this:
public class HtmlTable extends AbstractControl { ... public void render(HtmlStringBuffer buffer) { // Rendering Start buffer.elementStart("table"); appendAttributes(buffer); buffer.elementClose(); renderRows(buffer); buffer.closeElement("table"); // Rendering End } public String toString() { int estimatedControlSize = 1000; HtmlStringBuffer buffer = new HtmlStringBuffer(estimatedControlSize); render(buffer); return buffer.toString(); } }Note, the code between the commented section, was moved from toString to the render method. Also note that invoking a Control's toString() method still outputs the same HTML representation, as toString() delegates to the render method.
<click-app charset="UTF-8"> <pages package="net.sf.click.examples.page"/> <log-service classname="net.sf.click.extras.service.JdkLogService"/> </click-app>While it is generally not recommended to use the Click LogService in your application code, you can retrieve it using the ClickUtils method getLogService().