facelets 模板机制
<html xmlns=http://www.w3.org/1999/xhtml xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"> <body> <ui:composition template="template.xhtml"> <ui:define name="content"> <h:outputText value="我们在这里扩展content啦" /> </ui:define > <ui:remove>这里面的内容编译时不会显示(一般用来写注释之类的……)<ui:remove> </ui:composition> <body> </html>
//ui:composition的template属性选择调用那个模板,ui:define属性选择扩展哪个位置。
//ui:composition外面的内容会全部被忽略,在它外面写注释很方便
//如果想用模板 又不想忽略外面的内容用 ui:decorate
//ui:remove里面的内容编译时是不会出现在页面上的,一般写注释或者测试中间代码
//ui:param
此标记用来在facelet直接传递对象 ,其name必须跟composition标记或者decorate标记嵌套的define标记的name匹配起来。