Jsf-outputscript-tag
提供:Dev Guides
JSF-h:outputScript
h:outputScriptタグは、タイプが「script」でタイプが「text/javascript」のHTML要素をレンダリングします。 このタグは、外部JavaScriptファイルをJSFページに追加するために使用されます。
JSFタグ
レンダリングされた出力
応用例
上記のタグをテストするテスト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 | Create resources folder under src → main folder. |
3 | Create js folder under src → main → resources folder. |
4 | Create help.js file under src → main → resources → js folder. |
5 | Modify help.js file as explained below. |
6 | Modify pom.xml as explained below. |
7 | Modify home.xhtml as explained below. Keep rest of the files unchanged. |
8 | Compile and run the application to make sure business logic is working as per the requirements. |
9 | Finally, build the application in the form of war file and deploy it in Apache Tomcat Webserver. |
10 | Launch your web application using appropriate URL as explained below in the last step. |
help.js
pom.xml
home.xhtml
すべての変更を完了したら、JSF-最初のアプリケーションの章で行ったようにアプリケーションをコンパイルして実行します。 すべてがアプリケーションで問題ない場合、次の結果が生成されます。