メニュー

ループ処理
条件文
値の受け渡し
static修飾子

配列の作成
ArrayListを使う
ArrayListと配列の変換

ファイル関係
ファイル読み込み
ファイル書き込み
オブジェクトのシリアライズ処理
バイナリファイルの入出力

今日の日付の取得

クラス
インターフェース

例外処理

スレッド関係
スレッド処理
スレッド処理の終了を待つ
スレッド間の同期処理

JDBCでMySQLに接続

Swing
フレームを表示
ボタンを配置
トグルボタンを配置
チェックボックスを配置
コンボボックスを配置
ラジオボタンを配置
リストを配置
プログレスバーを配置
テーブルを配置
パネルを配置
メニューバーを配置

JSP
スクリプティング
JavaBeansの利用
POSTデータ取得
Servletからリクエストデータ取得
jsp:forwardタグ
JSP Servlet JavaBeans連携

Servlet
Servletを作成
Postデータ取得

JSF
JavaBeansを利用
dataTableを利用
ボタンにイベントを追加
画面遷移
selectOneListbox
selectBooleanCheckbox

binding
selectManyListbox(bindingで配置)

Struts
Strutsを利用する

トップ
E-Mail
xml

ASP.Netのお勉強
VB.Netのお勉強
phpのお勉強
Excel マクロ・VBAのお勉強
ASP.Netで掲示板を作成しよう
AJAXのお勉強
Webデザインのお勉強
連想書籍検索
世界の観光地検索
路線図
総合サイトCocoaLiz

Valid HTML 4.01 Transitional

JSF binding@Java

JSFでbindingを行います。
jsfで配置したコンポーネントとバッキングビーンをbindingします。

jspにinputText、commandButton、outputLabelを配置します。
それぞれにbindingを設定します。
また、ボタンにはactionを設定します。

Beanを作成します。
bindingするメンバを作成します。
また、ボタンを押した時の処理を記述します。

jsp

<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<% request.setCharacterEncoding("UTF-8");%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>inputText、commandButton、outputLabel binding</title>
</head>
<body>

    <f:view>
        <h:form>
            <h:inputText id="inputText" binding="#{ViewPageBean.inputText}" />
            <br>
            <h:commandButton id="btn" binding="#{ViewPageBean.btn}" action="#{ViewPageBean.btnClick}" />
            <h:outputLabel id="outputLabel" binding="#{ViewPageBean.outputLabel}" />
        </h:form>
    </f:view>

</body>
</html>


Bean

package Beans;

import javax.faces.component.html.*;


public class ViewPageBean {

    //javax.faces.component.html
    private HtmlInputText inputText;
    private HtmlOutputLabel outputLabel;
    private HtmlCommandButton btn;

    public ViewPageBean() {
        //HtmlInputText
        inputText = new HtmlInputText();

        //HtmlOutputLabel
        outputLabel = new HtmlOutputLabel();

        //HtmlCommandButton
        btn = new HtmlCommandButton();
        btn.setValue("実行");
    }

    public HtmlInputText getInputText() {
        return this.inputText;
    }

    public void setInputText(HtmlInputText inputText) {
        this.inputText = inputText;
    }

    public HtmlOutputLabel getOutputLabel() {
        return this.outputLabel;
    }

    public void setOutputLabel(HtmlOutputLabel outputLabel) {
        this.outputLabel = outputLabel;
    }

    public HtmlCommandButton getBtn() {
        return this.btn;
    }

    public void setBtn(HtmlCommandButton btn) {
        this.btn = btn;
    }

    //ボタンクリック処理
    public void btnClick() {
        this.outputLabel.setValue(this.inputText.getValue());
    }
}




Copyright (C) Javaのお勉強. All Rights Reserved.