读书人

facelets 标签参照 2

发布时间: 2012-10-24 14:15:58 作者: rapoo

facelets 标签参考 2

关键字: facelets 标签参考 2

xmlns:ui="http://java.sun.com/jsf/facelets">

<body>

<ui:composition>

<div>

<h3>#{birdName}</h3>

Order: #{birdOrder}

<br/>

Family: #{birdFamily}

</div>

</ui:composition>

</body>

</html>

在下面文件中引用前面定义的模板文件

Listing 1-18. param-example.xhtml

<!DOCTYPE html PUBLIC "-//W3C//DTD ?

XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/ ?

xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"

xmlns:ui="http://java.sun.com/jsf/facelets">

<body>

<ui:include src="param-details.xhtml">

<ui:param name="birdName" value="Parrot"/>

<ui:param name="birdOrder" value="Psittaciformes"/>

<ui:param name="birdFamily" value="Psittacidae"/>

</ui:include>

<ui:decorate template="param-details.xhtml">

<ui:param name="birdName" value="Eagle"/>

<ui:param name="birdOrder" value="Falconiformes"/>

<ui:param name="birdFamily" value="Accipitridae"/>

</ui:decorate>

</body>

</html>

产生如下输出:

<div>

<h3>Parrot</h3>

Order: Psittaciformes

<br />

Family: Psittacidae

</div>

<div>

<h3>Eagle</h3>

Order: Falconiformes

<br />

Family: Accipitridae

</div>

?

<ui:remove/>

<ui:remove> 用来在在编译时移除代码块,它没有属性,可以在 jsfc 的属性中指定。

例如:

<ui:remove>

This will be removed.

</ui:remove>

This will survive

<div jsfc="ui:remove">

This will be removed too

<h:outputText value="#{backingBean.andThisToo}"/>

</div>

And this will survive too!

产生如下输出:

This will survive

This will survive too!

<ui:repeat/>

<ui:repeat/> 用来跌代一个对象列表。推荐用 JSTL 核心标签库中的 c:forEach 代替。不作介绍。

?

读书人网 >Web前端

热点推荐