The HTML framework is used to generate HTML code, so there is a String toHtml() method.
The index model of the HTML framework is xworker.html.Widgets.
There can be multiple main models as needed. The main model needs to inherit xworker.html.Widgets. The code of the toHtml() method of the main model is as follows.
public static String toHtml(ActionContext actionContext){
//Get the model
Thing self = actionContext.getObject("self");
//The main model sets the html code according to the situation
String html = ...;
//Code to generate child nodes
for(Thing child : self.getChilds()){
//Call the toHtml method of the child node to generate the code of the child node
String childHtml = child.doAction("toHtml", actionContext);
//Add to html code
if(childHtml != null){
html = html + "\n" = childHtml;
}
}
//return html
return html;
}
The following video demonstrates customizing an HTML component:
Copyright © 2007-2019 XWorker.org 版权所有 沪ICP备08000575号