Jsf-outputtext-tag
提供:Dev Guides
JSF-h:outputText
h:outputTextタグは、HTMLテキストをレンダリングします。
JSFタグ
<h:outputText value = "Hello World!"/>
レンダリングされた出力
Hello World!
タグ属性
S.No | Attribute & Description |
---|---|
1 |
id コンポーネントの識別子 |
2 |
binding バッキングBeanで使用できるコンポーネントへの参照 |
3 |
rendered ブール値。 falseはレンダリングを抑制します |
4 |
styleClass カスケードスタイルシート(CSS)クラス名 |
5 |
value コンポーネントの値、通常は値バインディング |
6 |
converter コンバータークラス名 |
7 |
style インラインスタイル情報 |
8 |
title アクセシビリティのために使用される、要素を説明するタイトル。 視覚的なブラウザは通常、タイトルの価値に関するツールチップを作成します |
応用例
上記のタグをテストするテストJSFアプリケーションを作成しましょう。
Step | Description |
---|---|
1 | Create a project with a name helloworld under a package com.finddevguides.test as explained in the JSF - First Application chapter. |
2 | Modify home.xhtml as explained below. Keep rest of the files unchanged. |
3 | Compile and run the application to make sure business logic is working as per the requirements. |
4 | Finally, build the application in the form of war file and deploy it in Apache Tomcat Webserver. |
5 | Launch your web application using appropriate URL as explained below in the last step. |
home.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">
<head>
<title>JSF Tutorial!</title>
</head>
<body>
<h2>h:outputText example</h2>
<hr/>
<h:form>
<h3>Text</h3>
<h:outputText value = "Hello World"/>
</h:form>
</body>
</html>
すべての変更を完了したら、JSF-アプリケーションの作成の章で行ったようにアプリケーションをコンパイルして実行します。 すべてがアプリケーションで問題ない場合、次の結果が生成されます。