public class LayoutTag extends Tag
content.html内容如下:
<%layout("/org/bee/tl/samples/layout.html"){%>
this is 正文
..........
<%}%>
layout.html 是布局文件,内容如下·
this is header
this is content:${layoutContent}
this is footer:
运行content.html模板文件后,,正文文件的内容将被替换到layoutContent的地方,变成如下内容
this is header
this is content:this is 正文
............
this is footer:
如果向布局传入参数,则可以使用这种格式
layout(path,{'paraName1':value1,'paraName2',value2})
如果变量layoutContent与模板有冲突,可以作为第三个参数传入到layout变量里,如:
layout(path,{},"xxxLayoutContent");| 限定符和类型 | 字段和说明 |
|---|---|
static String |
defaultLayoutName |
| 构造器和说明 |
|---|
LayoutTag() |
| 限定符和类型 | 方法和说明 |
|---|---|
protected String |
getRelResourceId() |
void |
render() |
afterRender, containHtmlAttribute, doBodyRender, getArgs, getBodyContent, getHtmlAttribute, getParent, inintBase, init, setTagParentCopyright © 2019. All rights reserved.