JSF2 の概要 †

a graph image

サンプルプログラム †

screen.png

xhtml から ManagedBean? の呼び出し †

<h:commandButton value="投稿" action="#{commentController.doPublish}"/>

で、commentController の doPublish() が呼び出される。
ボタンではなく、リンクで呼び出したいときは

<h:commandLink value="投稿" action="#{commentController.doPublish}"/>

xhtml での入力内容を ManagedBean? に格納する †

<h:inputText value="#{commentController.comment}"/>

で、commentController の setComment() が呼び出される

ManagedBean? から xhtml の呼び出し †

public class CommentController {
   public String doPublish() {
       return "simpleResult.xhtml";
   }
}

h:commandButton> から呼び出されるメソッドの返値の型は String で、xhtml 名を返す。

ManagedBean? のフィールド変数を xhtml で読み出す †

<h:outputText value="#{commentController.comment}"/>

で、commentController の getComment() が呼び出される

xhtml から xhtml の呼び出し †

<h:link outcome="simpleComment" value="戻る" />

で、simpleComment.xhtml が呼び出される

xhtml をディレクトリ分けする †

WebContent
  |
  +-simpleComment.xhtml
  |
  +-sub
      |
      +-simpleReuslt.xhtml

のように、配置した場合には、どのようにリンクを設定すれば良いか?

ManagedBean? に参照名をつけたい †


Glassfish JSF2


添付ファイル: filescreen.png 2195件 [詳細]

Last-modified: 2013-06-09 (日) 11:34:16 (4911d)
Short-URL: https://pukiwiki.at-sushi.com/pukiwiki/?cmd=s&k=4565d496f0
ISBN10
ISBN13
9784061426061