[TEEDA-313] 任意の場所でincludeを使っている場合に、親Pageの方のボタンが実行されない場合がある Created: 2007-06-13  Updated: 2007-06-22  Resolved: 2007-06-22

Status: Resolved
Project: Teeda
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: shot Assignee: higa
Resolution: Fixed Votes: 0
Labels: None


 Description   

Seasar-user:8255

任意の場所でincludeを使っている場合に、親Pageの方のボタンが実行されない場合がある。
te:includeのあり・なしで、親のhtml(ここではhello.html)でボタンを実行したときに
Pageクラスのdoメソッドが呼ばれるか呼ばれないかが変わる。

下記サンプルコード。

<?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" xml:lang="ja" lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title id="aaa">Hello</title>
</head>
<body>
<form id="form">
こんにちは&nbsp;&nbsp;&nbsp;<span id="name">World!!!</span>
<input type="submit" value="calculate" id="doXxx"/>
<te:include te:src="/add/add.html"/><br />
</form>
</body>
</html>
/*
 * Copyright 2004-2007 the Seasar Foundation and the Others.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */
package examples.teeda.web.hello;

import examples.teeda.web.add.AddPage;

public class HelloPage {

	private String name = "Seasar2";

	private AddPage addPage;

	public AddPage getAddPage() {
		return addPage;
	}

	public void setAddPage(AddPage addPage) {
		this.addPage = addPage;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String initialize() {
		System.out.println("initialize");
		return null;
	}

	public String prerender() {
		System.out.println("prerender");
		return null;
	}

	public String getAaaTitleText() {
		return "AAA";
	}

	public String doXxx() {
		System.out.println("doXxx");
		getAddPage().xyz();
		return null;
	}
}
<?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" xml:lang="ja" lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title id="aaa">Add</title>
<style>
.onTeedaError {
	background-color: #FFCCCC;
}
</style>
</head>
<body>
<span id="mockAaa">aaa</span>
<form id="addForm">
<div>
<span id="messages"></span>
</div>
<table>
<tr>
<td></td><td><input type="text" id="arg1" title="INPUT1"/></td>
<td><span id="arg1Message"></span></td>
</tr>
<tr>
<td> + </td>
<td><input type="text" id="arg2" title="INPUT2"/></td>
<td><span id="arg2Message"></span></td>
</tr>
<tr>
<td> = </td>
<td><span id="result"></span></td>
</tr>
</table>
<input type="submit" value="calculate" id="doOnceCalculate" te:renderJs="true"/>
<input type="submit" value="back to start" id="jumpStart_index"/>

<input type="hidden" id="arg2-hidden"/>
</form>
</body>
</html>
/*
 * Copyright 2004-2007 the Seasar Foundation and the Others.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */
package examples.teeda.web.add;

public class AddPage {

	public static final String arg1_TGreaterThanConstantValidator = null;

	public static final String arg2_TGreaterThanConstantValidator = null;

	private int arg1;

	private int arg2;

	private int result;

	public int getArg1() {
		return arg1;
	}

	public void setArg1(int arg1) {
		this.arg1 = arg1;
	}

	public int getArg2() {
		return arg2;
	}

	public void setArg2(int arg2) {
		this.arg2 = arg2;
	}

	public int getResult() {
		return result;
	}

	public void setResult(int result) {
		this.result = result;
	}

	public String doOnceCalculate() {
		result = arg1 + arg2;
		return null;
	}

	public void xyz() {
		arg2 = 12345;
	}
}


 Comments   
Comment by higa [ 2007-06-22 ]

includeの親と子にformがあってネストしているため。
子供のフォームをはずせば大丈夫。

Generated at Wed Apr 09 08:06:13 JST 2025 using Jira 10.5.0#10050000-sha1:9d9d098bb7b67e8dba8da380ba9c3900d82ac3cf.