欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
Facelets 標簽參考 1

Facelets 標簽參考 1 -grule

lxm翻譯自《Facelets Essentials: Guide to JavaServer? Faces View Definition Framework 》

不當之處歡迎指正。

<ui:component/>

<ui:component> 標簽在 JSF 組件樹(shù)中插入一個(gè) UIComponet 實(shí)例,并作為所有它所包含的組件或內容片斷的根節點(diǎn)。表格 1-4 列出它的屬性。

表格 1-4: <ui:component> 標簽屬性

屬性名稱(chēng)

必需

描述

id

和所有的組件一樣,可以這它提供一個(gè) id, 如果沒(méi)有設置, Facelets 將按照 JSF 的規則為它創(chuàng )建一個(gè)。

binding

按照 JSF 的規范 , 這個(gè)屬性的作用是通過(guò)指向 Managed Bean 的一個(gè)屬性來(lái)引用 UIComponet 的實(shí)例 , 如果 Managed Bean 的這個(gè)個(gè)屬性沒(méi)有事先初始化, UIComponet 實(shí)例將惰性 (lazily) 被創(chuàng )建 .

這個(gè)標簽以外的內容將被編譯器忽略 , 因此不會(huì )顯示在視圖中。

這里以及這里以前的內容將被忽略

<ui:component binding="#{backingBean.myComponent}">

<div>The directory contains #{totalBirds} birds!</div>

</ui:component>

這里以及這里后的內容將被忽略

產(chǎn)生的 Html 輸出為:

The directory contains #{totalBirds} birds!

<ui:fragment/>

<ui:fragment> 標簽相似,不同的是 <ui:fragment> 標簽外部的內容不會(huì )被忽略。下列表格列出它的屬性。

表格 : <ui:fragment> 標簽屬性

屬性名稱(chēng)

必需

描述

id

和所有的組件一樣,可以這它提供一個(gè) id, 如果沒(méi)有設置, Facelets 將按照 JSF 的規則為它創(chuàng )建一個(gè)。

binding

按照 JSF 的規范 , 這個(gè)屬性的作用是通過(guò)指向 Managed Bean 的一個(gè)屬性來(lái)引用 UIComponet 的實(shí)例 , 如果 Managed Bean 的這個(gè)個(gè)屬性沒(méi)有事先初始化, UIComponet 實(shí)例將惰性 (lazily) 被創(chuàng )建 .

<ui:component> 標簽在 JSF 組件樹(shù)中插入一個(gè) UIComponet 實(shí)例,并作為標簽內部所有它所包含的組件或內容片斷的根節點(diǎn) , 標簽外部的內容編譯時(shí)會(huì )被包含進(jìn)來(lái)。

舉例:

This will not be ignored

<ui:fragment>

<div>

<h:outputText value="I want #{eagle.total} eagles."/>

</div>

</ui:fragment>

This will not be ignored

產(chǎn)生輸出:

This will not be ignored

<div>I want 3 eagles.</div>

This will not be ignored

<ui:composition/>

<ui:composition> 標簽是一個(gè)模板標簽,它將一些可以被其它 Facelets 頁(yè)面所包含的內容封裝起來(lái)。表格 1-5 列出它的屬性。

表格 1-5: <ui:component> 標簽屬性

屬性名稱(chēng)

必需

描述

template

將在標簽開(kāi)始和結束之間顯示的模板文件所在的路徑

<ui:composition> 指定使用哪個(gè)模版文件,然后通過(guò) <ui:define> 對模版文件中每個(gè)可供插入的“ <ui:insert> 錨點(diǎn)”進(jìn)行定義。 在運行期,具體的內容將會(huì )被插入到 <ui:composition> 中定義的錨點(diǎn)位置。

和 ui:component 一樣,這個(gè)標簽以外的內容將被編譯器忽略 , 不會(huì )顯示在視圖中 , 和 ui:component 不同的是, ui:composition 不會(huì )在組件樹(shù)上創(chuàng )建節點(diǎn)。

這里以及這里以前的內容將被忽略

<ui:composition>

<h:outputText value="#{bird.lifeExpectancy}" />

</ui:composition>

這里以及這里后的內容將被忽略

例如 :

<ui:composition template="bird-template.xhtml">

<ui:define name="title">Input Name</ui:define>

<ui:define name="summary">

<h:panelGrid columns="2">

<h:outputText value="Bird Name"/>

<h:outputText value="#{bird.name}"/> 34 Facelets Essentials

<h:outputText value="Life expectancy"/>

<h:outputText value="#{bird.lifeExpectancy}"/>

</h:panelGrid>

</ui:define>

</ui:composition>

這樣 composition 標簽內的內容按 bird-template.xhtml 模板文件的定義顯示 , 模板文件中中必須有 <ui:insert name="title"> 和 <ui:insert name="summary"> 的定義。

創(chuàng )建一個(gè)組合視圖主要使用 ui:composition, ui:define 和 ui:insert 標簽。

<ui:decorate/>

<ui:decorate> 標簽和 <ui:composition> 標簽相似,唯一不同的是它不忽略標簽外部的內容。

表格 1-6 列出它的屬性。

表格 1-6: <ui:decorate> 標簽屬性

屬性名稱(chēng)

必需

描述

template

將在標簽開(kāi)始和結束之間顯示的模板文件所在的路徑

例子:

Listing 1-10. box-template.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"> 36 Facelets Essentials

<body>

<ui:composition>

<div style="border: 1px solid black; display:block">

<ui:insert name="header"/>

</div>

<div style="border: 1px solid black; display:block">

<ui:insert name="content"/>

</div>

</ui:composition>

</body>

</html>

Listing 1-11. decorate-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"

xmlns:h="http://java.sun.com/jsf/html">

<head>

<title>Decorate example</title>

</head>

<body>

<p>These are the birds in today's menu:</p>

<ui:decorate template="box-template.xhtml">

<ui:define name="header">

Happy Parrot

</ui:define>

<ui:define name="content">

How many parrots do you want?

<h:inputText value="3"/>

</ui:define>

</ui:decorate>

<br/>

<ui:decorate template="box-template.xhtml">

<ui:define name="header">

Mighty Eagle

</ui:define>

<ui:define name="content">

Eagles are not available now.

</ui:define>

</ui:decorate>

</body>

</html>

html 輸出內容 :

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

<head>

<title>Decorate example</title>

</head>

<body>

<p>These are the birds in today's menu:</p>

<div style="border: 1px solid black; display:block">

Happy Parrot

</div>

<div style="border: 1px solid black; display:block">

How many parrots do you want?

<input id="_id6" name="_id6"

type="text" value="3" />

</div>

<br/>

<div style="border: 1px solid black; display:block">

Mighty Eagle

</div>

<div style="border: 1px solid black; display:block">

Eagles are not available now.

</div>

</body>

</html>

<ui:define/>

ui:define 標簽用于將命名的內容插入到模板中 , 它在模板標簽(如 composition 和 decorate )的內部使用。 Define 的 name 屬性必須和目標模板中 ui:insert 標簽的 name 屬性一致。表格 1-7 列出它的屬性。

表格 1-7: <ui:define> 標簽屬性

屬性名稱(chēng)

必需

描述

name

必須和目標模板中 ui:insert 標簽的 name 屬性一致

舉例 1:

<ui:decorate template="box-template.xhtml">

<ui:define name="header">

Happy Parrot

</ui:define>

this will be removed

<ui:define name="content">

How many parrots do you want?

</ui:define>

</ui:decorate>

define 標簽內部的內容將被插入到目標模板中 name 相同的 insert 標簽處。 define 標簽外部的內容將被忽略。

舉例 2:

Listing 1-12. define-template.xhtml

<h:outputText value="Which bird sings like this? "/>

<ui:insert name="song"/>

define-example.xhtml

This will be ignored

<ui:composition template="define-template.xhtml">

<ui:define name="song">

<h:outputText value="cock-a-doodle-doo"/>

</ui:define>

</ui:composition>

這個(gè)例子輸出 :

Which bird sings like this? cock-a-doodle-doo

<ui:insert/>

ui:insert 標簽用來(lái)在模板中指定一個(gè)插入點(diǎn),可以被客戶(hù)端模板中 ui:define 定義的內容所代替。 表格 1-8 列出它的屬性。

表格 1-8: <ui:insert> 標簽屬性

屬性名稱(chēng)

必需

描述

name

用來(lái)和客戶(hù)端模板中 ui:define 標簽的 name 屬性相一致 , 如果沒(méi)有指定,整個(gè)客戶(hù)端模板將被插入。

如果模板中某個(gè) insert 標簽在客戶(hù)端模板中沒(méi)有定義對應的 define ,則使用模板中的默認值。

Listing 1-13. insert-template.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>

<h1>

<ui:insert name="title">

No title

</ui:insert>

</h1>

<div>

<ui:insert name="content">

No content is defined

</ui:insert>

</div>

</body>

</html>

我們需要一個(gè)客戶(hù)端模板 , 如下:

Listing 1-14. insert-client.xhtml

<ui:composition template="insert-template.xhtml">

<ui:define name="title">

The Parrot Quest

</ui:define>

</ui:composition>

我們只定義了 title 的內容,所以 content 使用默認值。輸出如下:

<h1>

The Parrot Quest

</h1>

<div>

No content is defined

</div>

name 屬性是可選的,如果沒(méi)有被指定,整個(gè)客戶(hù)端模板將被插入。也沒(méi)必須要客戶(hù)端模板定義 define 。如下:

Listing 1-15. insert-template2.xhtml

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

HTML 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>

<div>

<h1>One story of Birds</h1>

<ui:insert/>

</div>

</body>

</html>

Listing 1-16. insert-client2.xhtml

<ui:composition template="insert-template2.xhtml">

One day I decided to start counting

the number of parrots in the world,

just to find that...

<br/>

<h:inputTextarea value="#{backingBean.story}"/>

</ui:composition>

輸出如下:

<div>

<h1>One story of Birds</h1>

One day I decided to start counting

the number of parrots in the world,

just to find that...

<br />

<textarea name="_id3"></textarea>

</div>

<ui:include/>

<ui:include/> 標簽用來(lái)在文件中包含另外一個(gè) Facelets 文件 , 它只需要指定被包含文件的位置。它可以包含任何擁有 ui:component 或 ui:composition 等標簽或是簡(jiǎn)單的 XHTML 或 XML 代碼片斷的文件。下列表格列出它的屬性。

表格 : <ui:include> 標簽屬性

屬性名稱(chēng)

必需

描述

src

屬性的值可以是簡(jiǎn)單的值或是 EL 表達式,用來(lái)指定被包含的 Faclets 文件的位置 , 可以是相對路徑也可以是絕對路徑。

舉例:

<div>

<ui:include src="#{backingBean.currentMenu}"/>

</div>

http://www.javaeye.com/post/628412 原文
hxzon:facelets6個(gè)模板標簽,4個(gè)非模板標簽,分別為
composition,decorate,define,insert,include,param,,,
component,fragment,remove,debug。(模板文件,模板客戶(hù)文件)。

本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
Struts2 標簽庫 [Tablib] (轉) - 蘭色的海洋 - 51CTO技術(shù)博客
struts2中form的theme屬性
基于Web標準的UI組件 — 菜單(1)
aspx與aspx.cs的關(guān)系(1)
Dreamweaver網(wǎng)頁(yè)設計 復制
vue2組件系列第一節:Layout布局
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久