apex:composition
2 番目のテンプレートページのコンテンツを含むページの領域です。テンプレートページは、1 つ以上の <apex:insert> コンポーネントを含む Visualforce ページです。<apex:composition> コンポーネントは、関連付けられているテンプレートを指定し、テンプレートの <apex:insert> コンポー���ントの本文に、一致する <apex:define> コンポーネントを提供します。<apex:composition> コンポーネント外のコンテンツは表示されません。
このコンポーネントを使用して、sObject の項目に対応しないコントローラーメソッドのユーザー入力を取得します。sObject 項目で使用できるのは、<apex:inputField> と <apex:outputField> のみです。
<apex:insert>、<apex:define> も参照してください。
例
1<!-- Page: composition -->
2<!-- This page acts as the template. Create it first, then the page below. -->
3<apex:page>
4 <apex:outputText value="(template) This is before the header"/><br/>
5 <apex:insert name="header"/><br/>
6 <apex:outputText value="(template) This is between the header and body"/><br/>
7 <apex:insert name="body"/>
8</apex:page>
9
10<!-- Page: page -->
11<apex:page>
12 <apex:composition template="composition">
13 <apex:define name="header">(page) This is the header of mypage</apex:define>
14 <apex:define name="body">(page) This is the body of mypage</apex:define>
15 </apex:composition>
16</apex:page>上述の例では次の HTML を表示します。
1(template) This is before the header<br/>
2(page) This is the header of mypage<br/>
3(template) This is between the header and body<br/>
4(page) This is the body of mypage属性
| 属性名 | 属性型 | 説明 | 必須かどうか | API バージョン | 通用範囲 |
|---|---|---|---|---|---|
| rendered | String |
このコンポーネントの表示には、この属性による影響はありません。<apex:component> を条件に基づいて表示する場合は、<apex:outputPanel> コンポーネント内にラップし、その rendered 属性に条件式を追加します。 |
10.0 | グローバル | |
| template | ApexPages.PageReference | このコンポーネントで使用するテンプレートページ。この値では、Visualforce ページの名前を指定するか、または差し込み項目の構文を使用して、ページまたは PageReference を参照します。 | はい | 10.0 | グローバル |