リファレンス: JSF標準コンポーネント

JavaServer Facesには、次のコンポーネント・タグ・ライブラリが用意されています。

ライブラリ構文

JSPページ

<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> 

JSPドキュメント

<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">

タグ構文の使用方法

サポートされるすべての属性が、大カッコ([ ])内に示されます。該当する場合は、デフォルトの値が提供されます(例: [disabled="false"])。属性の後に配置されるアスタリスク(*)は、値が必要であることを意味します。該当する場合は、サポートされる子とファセットのコンポーネントも示されます。

標準のJSFコア・タグ・ライブラリ

コンポーネント・タグ 構文
f:actionListener - 最も近い親コンポーネントに関連付けられたUIComponentにアクション・リスナーを登録します。
<f:actionListener
	[type] /> 
f:attribute - 構成可能な属性を親コンポーネントに追加します。
<f:attribute
  	[name]
	[value]
/>
f:convertDateTime - ID javax.faces.DateTimeに登録するコンバータのインスタンスを作成および構成します。
<f:convertDateTime
  [dateStyle]
  [timeStyle]
  [pattern]
  [type]
  [locale]
  [timezone]
/>
f:converter - 指定のコンバータIDに登録するクラスのインスタンスを作成して(javax.faces.convert.Converterインタフェースを実装する必要があります)、最も近いJSFコンポーネントの親アクション要素が示すコンポーネントに関連付けます。
<f:converter
	[converterID />
f:convertNumber - ID javax.faces.Numberに登録するコンバータのインスタンスを作成および構成します。
<f:convertNumber
  	[pattern]
  	[minIntegerDigits]
	[maxIntegerDigits]
  	[minFractionDigits]
	[maxFractionDigits]
  	[groupingUsed="true"] 
	[integerOnly="false"]
  	[type="number"] 
  	[currencyCode]
	[currencySymbol]
  	[locale] 
/>
f:facet - JSFアクションの本体が示すコンポーネントを、指定の名前を持つファセットとして、最も近いJSFコンポーネントの親アクション要素が示すコンポーネントに追加します。
<f:facet
	[name]
	JSF action components
</f:facet>
f:loadBundle - マップとして公開されるリソース・バンドルを指定するローカライズ・タグ。
<f:loadBundle
	[basename]
	[var]
/> 
f:param - パラメータをMessageFormatインスタンスに置換し、問合せ文字列の名前と値のペアをURLに追加します。
<f:param value="value"
	[id]
	[binding]
	[name]
/>
f:selectItem - UISelectOneまたはUISelectManyコンポーネントのアイテム・リスト内にある1つのアイテムを表します。
<f:selectItem
	[id]
	[binding]
	[value="value" | 
		itemValue="itemValue" itemLabel="itemLabel" 
		[itemDisabled="true|false"]
		[itemDescription="itemDescription"]
	]
/>
f:selectItems - UISelectOneまたはUISelectManyコンポーネントの一連のアイテムを表します。
<f:selectItems 
	[value]
	[id]
	[binding]
/>
f:subview - JavaServer Facesタグを含む別のJSPページに含まれているページに、すべてのJavaServer Facesタグを含めます。
<f:subview>
	[id]
	[binding]
	[rendered] 
</f:subview>
f:validateDoubleRange - ID javax.faces.DoubleRangeに登録するバリデータのインスタンスを作成および構成します。
<f:validateDoubleRange
  	[maximum]
  	[minimum]
/>
f:validateLength - ID javax.faces.Lengthに登録するバリデータのインスタンスを作成および構成します。
<f:validateLength
  	[maximum]
  	[minimum]
/>
f:validateLongRange - 指定された範囲内にあるコンポーネントのlong値を検証します。
><f:validateLongRange
  [maximum]
  [minimum]
/>
f:validator - コンポーネントにカスタム・バリデータを登録します。
<f:validator
	[validatorID />
f:valueChangeListener - 親コンポーネントに値変更リスナーを登録するイベント処理タグ。
<f:valueChangeListener
	[type] />
f:verbatim - このタグの本体からコンテンツを取得するUIOutputコンポーネントを生成します。
<f:verbatim
	[escape]
	Template text and/or JSF action elements
</f:verbatim>
f:view - <h:form>タグのコンテナを作成して、ページ上のすべてのJavaServer Facesタグを囲みます。
<f:view
	[local]
	JSF component action elements, template text and/or JSF action elements
</f:view>

標準のJSF HTMLタグ・ライブラリ

コンポーネント・タグ 構文
h:column - <h:dataTable>コンポーネントのテンプレート列を構成します。
<h:column
	[id]
	[binding]
	[rendered]
>
	[<f:facet name="header">...</facet>]
	[<f:facet name="footer">...</facet>]
	JSF action components
/h:column>
h:commandButton - フォームをアプリケーションに発行するUIボタンを作成します。
<h:commandButton value
    [id]
    [binding]
    [rendered]
    [image]
    [type]
    [action]
    [actionListener]
    [immediate]
<!--HTML attributes-->
/>
h:commandLink - 別のページやページ上の別の位置へのリンクを作成します。
<h:commandLink value
    [id]
    [binding]
    [rendered]
    [action]
    [actionListener]
    [immediate]
<!--HTML attributes-->
/>
h:dataTable - ページにデータ表を作成します。
<h:dataTable
	[id]
	[binding]
	[rendered]
	[value]
	[var]
	[first]
	[rows]
	[headerClass]
	[footerClass]
	[rowClasses]
	[columnClasses]
<!--HTML attributes-->
>
	[<f:facet name="header">...</facet>]
	[<f:facet name="footer">...</facet>]
	<h:column>
	JSF action components
	</h:column>
/h:dataTable>
h:form - 入力フォームを作成します。フォームの内部タグで受け取ったデータは、このフォームを使用して発行されます。
<h:form
    [id]
    [binding]
    [rendered]
<!--HTML attributes-->
>
    JSF action components
/>
h:graphicImage - ページ上にイメージを表示します。
<h:graphicImage
    url
    [id]
    [binding]
    [rendered]
    [value]
<!--HTML attributes-->
/>
h:inputHidden - ユーザーに表示されないフィールドを作成します。通常、このフィールドはページ間の変数の受渡しに使用されます。
<h:inputHidden
    value
    [id]
    [binding]
    [rendered]
    [redisplay]
    [converter]
    [required]
    [validator]
    [valueChangeListener]
    [immediate]
<!--HTML attributes-->
/>
h:inputSecret - パスワード入力フィールドを作成します。
<h:inputSecret
    value
    [id]
    [binding]
    [rendered]
    [redisplay]
    [converter]
    [required]
    [validator]
    [valueChangeListener]
    [immediate]
<!--HTML attributes-->
/>
h:inputText - 単純なユーザー入力テキスト・フィールドを作成します。
<h:inputText value
    [id]
    [binding]
    [rendered]
    [converter]
    [required]
    [validator]
    [valueChangeListener]
    [immediate]
<!--HTML attributes-->
/>
h:inputTextarea - 複数行テキストのユーザー入力テキスト領域を作成します。
<h:inputTextarea value
	[id]
	[binding]
	[rendered]
	[converter]
	[required]
	[validator]
	[valueChangeListener]
	[immediate]
<!--HTML attributes-->
/>
h:message - for属性で識別されたコンポーネントに対してキューイングされた最初のメッセージを受け取ります。
<h:message for
	[id]
	[binding]
	[rendered]
	[showDetail]
	[showSummary]
	[tooltip]
	[errorClass]
	[errorStyle]
	[fatalClass]
	[fatalStyle]
	[infoClass]
	[infoStyle]
	[warnClass="styleClass"]
	[warnStyle="style"]
<!--HTML attributes-->
/>
h:messages - キューイングされたすべてのメッセージ、または、コンポーネント識別子なしでキューイングされたメッセージ(globalOnly属性が"true"に設定されている場合)を受け取ります。
<h:messages for
	[id]
	[binding]
	[rendered]
	[showDetail]
	[showSummary]
	[globalOnly]
	[layout]
	[tooltip]
	[errorClass]
	[errorStyle]
	[fatalClass]
	[fatalStyle]
	[infoClass]
	[infoStyle]
	[warnClass]
	[warnStyle]
<!--HTML attributes-->
/>
h:outputFormat - ローカライズされたメッセージを表示します。
<h:outputFormat
    for
    [id]
    [binding]
    [rendered]
    [layout]
    [globalOnly]
    [errorClass]
    [errorStyle]
    [fatalClass]
    [fatalStyle]
    [infoClass]
    [infoSytle]
    [warnClass]
    [warnStyle]
    [tooltip]
    [showDetail]
    [showSummary]
<!--HTML attributes-->
/>
h:outputLabel - ネストされたコンポーネントを、指定した入力フィールドのラベルとして表示します。
<h:outputLabel
    for
    [id]
    [binding]
    [rendered]
    [converter]
<!--HTML attributes-->
    JSF action components
    or non-JSF content
/>
h:outputLink - アクション・イベントを生成せずに、別のページまたは別の場所へリンクします。
<h:outputLink
    value
    [id]
    [binding]
    [rendered]
    [converter]
<!--HTML attributes-->
>
    <f:param
        [name]
        [value]
    />
   JSF action components    
/>
h:outputText - テキストの行を表示します。
<h:outputText
    value
    [id]
    [binding]
    [rendered]
    [escape]
    [converter]
<!--HTML attributes-->
/>
h:panelGrid - 他のコンポーネントのコンテナ表を作成します。
<h:panelGrid columns="numberColumn"
	[id]
	[binding]
	[rendered]
	[headerClass]
	[footerClass]
	[rowClasses]
	[columnClasses]
<!--HTML attributes-->
>
	[<f:facet name="header">...</facet>]
	[<f:facet name="footer">...</facet>]
	JSF action components
/h:panelGrid>
h:panelGroup - 一連のコンポーネントを1つの親にグループ化するためのコンテナを作成します。
<h:panelGroup
	[id]
	[binding]
	[rendered]
<!--HTML attributes-->
>
	JSF action components
/panelGroup>
h:selectBooleanCheckbox - 単純なYes/Noユーザー・チェックボックスを作成します。
<h:selectBooleanCheckbox
    value
    [id]
    [binding]
    [rendered]
    [immediate]
    [converter]
    [required]
    [validator]
    [valueChangeListener]
<!--HTML attributes-->
/>
h:selectManyCheckbox - ユーザーが複数の値を選択できるように、一連のチェックボックスを作成します。
<h:selectManyCheckbox value
	[id]
	[binding]
	[rendered]
	[converter]
	[required]
	[validator]
	[valueChangeListener]
	[disabledClass]
	[enabledClass]
	[layout]
<!--HTML attributes-->
>
	<f:selectItem> and/or 
	<f:selectItems> action components
/h:selectManyCheckbox>
h:selectManyListbox - ユーザーが複数のアイテムを選択できるように、一度に表示する一連のアイテムを作成します。
<h:selectManyListbox value
	[id]
	[binding]
	[rendered]
	[converter]
	[required]
	[validator]
	[valueChangeListener]
	[immediate]
<!--HTML attributes-->
>
	<f:selectItem> and/or 
	<f:selectItems> action components
/h:selectManyListbox>
h:selectManyMenu - ユーザーが複数のアイテムを選択できるように、一連のアイテムを作成します。
<h:selectManyMenu value
	[id]
	[binding]
	[rendered]
	[converter]
	[required]
	[validator]
	[valueChangeListener]
	[immediate]
<!--HTML attributes-->
>
	<f:selectItem> and/or 
	<f:selectItems> action components
/h:selectManyMenu>
h:selectOneListbox - ユーザーが1つのアイテムを選択できるように、一度に表示する一連のアイテムを作成します。
<h:selectOneListbox value
	[id]
	[binding]
	[rendered]
	[converter]
	[required]
	[validator]
	[valueChangeListener]
	[immediate]
<!--HTML attributes-->
>
	<f:selectItem> and/or 
	<f:selectItems> action components
/h:selectOneListbox>
h:selectOneMenu - ユーザーが1つのアイテムを選択できるように、一連のアイテムを作成します。
<h:selectOneMenu value
	[id]
	[binding]
	[rendered]
	[converter]
	[required]
	[validator]
	[valueChangeListener]
	[immediate]
<!--HTML attributes-->
>
	<f:selectItem> and/or
	<f:selectItems> action components
/h:selectOneMenu>
h:selectOneRadio - ユーザーが1つの値を選択できるように、一連のラジオ・ボタンを作成します。
<h:selectOneRadio value
	[id]
	[binding]
	[rendered]
	[converter]
	[required]
	[immediate]
	[validator]
	[valueChangeListener]
	[disabledClass]
	[enabledClass]
	[layout]
<!--HTML attributes-->
>
	<f:selectItem> and/or 
	<f:selectItems> action components
/h:selectOneRadio>

属性カテゴリ

属性のカテゴリの詳細は、「JSF標準コンポーネントのタグ属性の概要」を参照してください。

一般属性とコア属性

ほとんどのJSF標準コンポーネント・タグでは、次の一般属性とコア属性がサポートされています。

HTMLのイベント属性とスタイル属性

JSF HTMLのタグ・ライブラリにあるJSPアクションでは、対応するHTML要素に対してHTML 4.01仕様が宣言されている属性のほとんどがサポートされています。各属性はオプションで、静的な値に設定したり、JSF EL式の任意のタイプを使用できます。

サポートされるクライアント側JavaScriptのイベント処理の属性は、次のとおりです。

onbluronchangeonclickondblclickonfocusonkeydownonkeypressonkeyuponloadonmousedownonmousemoveonmouseoutonmouseoveronmouseuponselectonunload

サポートされるスタイルとプレゼンテーションの属性は、次のとおりです。

backgroundbordercellpaddingcellspacingfontmarginstyleoutline

すべてのHTML要素の詳細は、http://www.w3.org/TR/html401/の「W3C HTML 4.01 Specification」を参照してください。


JavaServer Facesの使用
JSFアプリケーションの構成
コンポーネント・バインディングの使用