[Seasar-user:7627] Re: [Teeda] メッセージ出力時のdivによる表示・非表示処理について

Satoshi Takei [E-MAIL ADDRESS DELETED]
2007年 5月 14日 (月) 17:54:12 JST


武居です。

サンプルコードを作りましたのでよろしくお願いします。

-----------------------------------------------------------
[view/layout/layout.html]

<html xmlns:te="http://www.seasar.org/teeda/extension">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>test</title>
</head>
<body>
<te:include te:src="/layout/header.html"/>
<te:includeChildBody id="c"/>
</body>
</html>

-----------------------------------------------------------
[view/layout/header.html]

<?xml version="1.0" encoding="UTF-8"?>
<!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"
xmlns:te="http://www.seasar.org/teeda/extension">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<div id="isFuga">
fuga
</div>
</body>
</html>

-----------------------------------------------------------
[HeaderPageクラス]

public class HeaderPage {

private boolean fuga = false;

public boolean isFuga() {
return fuga;
}

public String initialize() {
fuga = true;
return null;
}

public String prerender() {
return null;
}

public void setFuga(boolean fuga) {
this.fuga = fuga;
}

}

-----------------------------------------------------------
[LayoutPageクラス]

public class LayoutPage {

public String initialize() {
return null;
}

public String prerender() {
return null;
}

}

-----------------------------------------------------------
[view/test/test.html]

<?xml version="1.0" encoding="UTF-8"?>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>

<div id="isHoge">
hoge
</div>

<span id="allMessages"/>

<form id="loginForm">
login : <input type="text" id="loginId" /><br />
password: <input type="password" id="password" /><br />
<input type="submit" id="doLogin" />
</form>

</body>

</html>

-----------------------------------------------------------

[TestPageクラス]

import org.seasar.teeda.extension.annotation.validator.Required;

public class TestPage {

@Required
private String loginId;

@Required
private String password;

private boolean hoge;

public String getLoginId() {
return loginId;
}

public void setLoginId(String loginId) {
this.loginId = loginId;
}

public String getPassword() {
return password;
}

public void setPassword(String password) {
this.password = password;
}

public String doLogin() {
return null;
}

public String initialize() {
hoge = true;
return null;
}

public String prerender() {
return null;
}

public boolean isHoge() {
return hoge;
}

}

http://〜/view/test/test.htmlを呼び出すと
それぞれのページクラスのinitializeメソッドで、
fuga=true, hoge=trueで初期化していますので、

fuga ←<div id="isFuga">fuga</div>の出力
hoge ←<div id="isHoge">hoge</div>の出力
login : [ ]
password: [ ]
[実行]

が表示されます。
loginとpasswordをブランクで[実行](submitボタン)を押下すると、
validationエラーとなり、上記の"fuga"と"hoge"の文字列は消えてしまいます。
(本当は表示してもらいたい)

以下のようにtest.htmlのformタグの中に、<div id="isHoge-2">を入れた場合、
エラー発生時には、HOGEHOGEボタンは表示されますが、文字列"hoge"は表示され
ません。

<body>

<div id="isHoge">
hoge
</div>

<span id="allMessages"/>

<form id="loginForm">
login : <input type="text" id="loginId" /><br />
password: <input type="password" id="password" /><br />
<input type="submit" id="doLogin" />
<div id="isHoge-2"> ...このタグを追加
<input type="submit" id="doLogin-2" value="HOGEHOGE"/>
</div>
</form>

</body>


以上、よろしくお願いします。


Shinpei Ohtani wrote:
> 大谷です。
>
> すいませんが下記の内容だけではわかりません。
> まずい部分は削った上でソースを掲載していただけないでしょうか。
>
> ちなみにConditionのソースを若干修正しましたが
> 修正前でも修正後でも私が示した簡単なサンプルの例は通っています。
> 宜しくお願いします。
>   
>   


-- 
武居聡([E-MAIL ADDRESS DELETED])




Seasar-user メーリングリストの案内