JDeveloperでのバッキングBean、メソッド・バインディングおよび自動コンポーネント・バインディングについて

バッキングBeanは、ユーザーの入力データおよびコンポーネントのデータの状態ホルダーの役割を果たします。バッキングBeanは、検証メソッドや、コンポーネント値を使用してバックエンド・アプリケーションのコードを起動するイベント・ハンドラ・メソッドを実装する場合に役立ちます。

JSFページに対して自動コンポーネント・バインディングが有効な場合、JDeveloperでは、デフォルトのマネージドBeanまたは選択したマネージドBeanを自動的に使用して、コンポーネントのbinding属性を制御します。つまり、ページに挿入するコンポーネントは、そのページのバッキングBeanのプロパティに自動的にバインドされます。自動コンポーネント・バインディングが有効な場合は、(Javaソース・エディタから)メソッド・バインディング・ツールバーを使用して、ページ上の選択コンポーネントに対してメソッド・バインディングを迅速かつ容易に作成できます。

メソッド・バインディングのコード・サンプル

デフォルト・バッキングBean: Myfile.java

public String commandButton_action()
{
  // Add event code here...
  return null;
}

public void listenact(ActionEvent actionEvent)
{
  // Add event code here...
}

public void listenvc(ValueChangeEvent valueChangeEvent)
{
  // Add event code here...
}

public void inputText_validator(FacesContext facesContext, UIComponent uiComponent, Object object)
{
 // Add event code here...
}
public String commandButton_action2()
{
  // Add event code here...
  return null;
}

public void commandButton_actionListener2(ActionEvent actionEvent) { // Add event code here... } public void commandButton_launchListener(LaunchEvent LaunchEvent) { // Add event code here... } public void commandButton_returnListener(ReturnEvent ReturnEvent) { // Add event code here... } public void inputText_valueChangeListener2(ValueChangeEvent valueChangeEvent) { // Add event code here... } public void inputText_validator2(FacesContext facesContext, UIComponent uiComponent, Object object) { // Add event code here... }

自動コンポーネント・バインディングが有効な状態のJSFページ(myfile.jsp

<h:commandButton value="button0"
                 binding="#{backing_myfile.commandButton1}"
                 action="#{backing_myfile.commandButton_action}"
                 actionListener="#{backing_myfile.listenact}"/>

<h:inputText binding="#{backing_myfile.inputText1}"
             valueChangeListener="#{backing_myfile.listenvc}"
             validator="#{backing_myfile.inputText_validator}"/>
<af:commandButton binding="#{backing_myfile.commandButton2}"
                  action="#{backing_myfile.commandButton_action2}"
                  actionListener="#{backing_myfile.commandButton_actionListener2}"
                  launchListener="#{backing_myfile.commandButton_launchListener}"
                  returnListener="#{backing_myfile.commandButton_returnListener}"/>

<af:inputText binding="#{backing_myfile.inputText2}"
              validator="#{backing_myfile.inputText_validator2}"
              valueChangeListener="#{backing_myfile.inputText_valueChangeListener2}"/>

JSFアプリケーションの作成
Webページおよび設計ツールの操作
HTMLページの操作
JSPページの操作