• Type: Bug
    • Resolution: Fixed
    • Priority: Major
    • None
    • Affects Version/s: 1.0.7
    • Component/s: Teeda Extension
    • None

      ページ間での値を引き継きが @SubapplicationScope を付けた時と付けない時で動作が異なる。
      (Pageクラスのプロパティのスコープは、サブアプリケーションなので、アノテーションを付けても
      付けなくても同じ振る舞いであるべき。)

      【再現方法】
      ①edit.htmlを用意
      ポイントを抜粋。

      <form id="Form">
      <input id="aaa" type="text"/>
      <input id="goConfirm" type="button" />
      </form>

      ②EditPageにて プロパティbbb を作成し、prerender内で bbbに値をセットする
      ポイントを抜粋。

      public String getBbb()

      { return bbb; }

      public void setBbb(String bbb)

      { this.bbb = bbb; }

      public Class prerender()

      { bbb = "bbb"; return null; }

      ③confirm.html を用意する。(ConfirmPageも)
      ポイントを抜粋。

      <span id="aaa" /><br />
      <span id="bbb" />

      ④ edit.html からサブミットして confirm.html に移動しても、
       bbb の値は表示されていない。

      ⑤ EditPageの bbbプロパティにSubapplicationScopeアノテーションを付けて、
       edit.html からサブミットして confirm.html に移動したらbbb の値は引き継がれるのが確認できる。

      @SubapplicationScope
      private String bbb;

          [TEEDA-335] SubapplicationScopeの挙動がおかしい

          shot added a comment -

          というわけでこの件はcloseとします.

          shot added a comment - というわけでこの件はcloseとします.

          shot added a comment -

          ひとまず、blogに詳細な動きと何故そうなっているのかを書いてみました.

          あとでドキュメントに起こそうと思います.

          http://d.hatena.ne.jp/shot6/20070717#1184668213

          shot added a comment - ひとまず、blogに詳細な動きと何故そうなっているのかを書いてみました. あとでドキュメントに起こそうと思います. http://d.hatena.ne.jp/shot6/20070717#1184668213

          jflute added a comment -

          ありがとうございます。
          これでちょっとすっきりしました。

          ただ、この違いをハッキリ理解している開発者は少ないように思えます。
          Seasar Conference 2007 Spring の 実践Teeda の資料の中にも

          SubApplicationScope (デフォルト)

          という記述がありました。
          「DefaultScopeについて」どこかで明示的に説明した方がいいかもしれません。

          jflute added a comment - ありがとうございます。 これでちょっとすっきりしました。 ただ、この違いをハッキリ理解している開発者は少ないように思えます。 Seasar Conference 2007 Spring の 実践Teeda の資料の中にも SubApplicationScope (デフォルト) という記述がありました。 「DefaultScopeについて」どこかで明示的に説明した方がいいかもしれません。

          shot added a comment -

          はい、UIコンポーネントとして認識されているかどうかは
          重要です.

          逆にサブアプリケーションスコープのアノテーションを付加していると
          なかば強制的にPagePersistenceで復元するので、
          UIコンポーネントとして認識されているかは関係ありません.

          shot added a comment - はい、UIコンポーネントとして認識されているかどうかは 重要です. 逆にサブアプリケーションスコープのアノテーションを付加していると なかば強制的にPagePersistenceで復元するので、 UIコンポーネントとして認識されているかは関係ありません.

          jflute added a comment -

          まとめると:

          【デフォルトスコープ】
          HTML上にComponentとして存在するPropertyで同じ名前のものは、
          SubApplication内で値を引き継ぐ。

          逆にPageクラスに同じ名前のPropertyが存在していても、
          HTML上のComponentとして存在していないのであれば値は引き継がない。

          【サブアプリケーションスコープ】
          HTML上にComponentとして存在するかどうかは関係なく、
          Pageクラスで同じ名前のPropertyの値を引き継ぐ。(指定したPropertyにおいて)

          という感じでしょうか???
          結構、利用者はこの辺皆勘違いしているようです。
          (というか自分も)

          jflute added a comment - まとめると: 【デフォルトスコープ】 HTML上にComponentとして存在するPropertyで同じ名前のものは、 SubApplication内で値を引き継ぐ。 逆にPageクラスに同じ名前のPropertyが存在していても、 HTML上のComponentとして存在していないのであれば値は引き継がない。 【サブアプリケーションスコープ】 HTML上にComponentとして存在するかどうかは関係なく、 Pageクラスで同じ名前のPropertyの値を引き継ぐ。(指定したPropertyにおいて) という感じでしょうか??? 結構、利用者はこの辺皆勘違いしているようです。 (というか自分も)

          higa added a comment -

          SubApplicationScopeのアノテーションがついていない場合、サブミット時にはbbbの値は消えてなくなるのは、仕様どおり。
          また、SubApplicationScopeのアノテーションがついている場合、render後に値が保持されるので、サブミット時に値が引き継がれるのも仕様どおり。

          デフォルトのスコープが、SubApplicationScopeというのが間違っていると思います。
          デフォルトのスコープは、Page,SubApplication,Redirectのどれでもありません。
          レンダー後、hiddenなどで値を保持しない限りは消えてしまいます。

          higa added a comment - SubApplicationScopeのアノテーションがついていない場合、サブミット時にはbbbの値は消えてなくなるのは、仕様どおり。 また、SubApplicationScopeのアノテーションがついている場合、render後に値が保持されるので、サブミット時に値が引き継がれるのも仕様どおり。 デフォルトのスコープが、SubApplicationScopeというのが間違っていると思います。 デフォルトのスコープは、Page,SubApplication,Redirectのどれでもありません。 レンダー後、hiddenなどで値を保持しない限りは消えてしまいます。

          shot added a comment -

          layoutなしの下記のプリミティブなコードで試してみました.
          結果、大丈夫そうです.

          <html>
          <head>
          <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
          <title>Add</title>
          </head>
          <body>
          <form id="addForm">
          <input type="hidden" id="message-hidden"/>
          <div>
          <span id="messages"></span>
          </div>
          <span id="message">input and click seasar logo!</span>
          <table>
          <tr>
          <td></td><td><input type="text" id="arg1"/></td>
          <td><span id="arg1Message"></span></td>
          </tr>
          <tr>
          <td> + </td>
          <td><input type="text" id="arg2"/></td>
          <td><span id="arg2Message"></span></td>
          </tr>
          </table>
          <input type="button" value="calculate" id="goAddResult"/>
          </form>
          </body>
          </html>
          
          public class AddInputPage {
          
          	public static final String arg1_TRequiredValidator = null;
          
          	public static final String arg1_lengthValidator = "minimum=3";
          
          	public static final String arg2_TRequiredValidator = null;
          
          	public static final String arg2_lengthValidator = "minimum=3";
          
          	private Integer arg1;
          
          	private Integer arg2;
          
          	private Integer result;
          
          	private String message;
          
          	public String initialize() {
          		message = "計算サンプル";
          		return null;
          	}
          
          	public void prerender() {
          		arg2 = new Integer(999);
          	}
          
          	public Integer getArg1() {
          		return arg1;
          	}
          
          	public void setArg1(Integer arg1) {
          		this.arg1 = arg1;
          	}
          
          	public Integer getArg2() {
          		return arg2;
          	}
          
          	public void setArg2(Integer arg2) {
          		this.arg2 = arg2;
          	}
          
          	public Integer getResult() {
          		return result;
          	}
          
          	public void setResult(Integer result) {
          		this.result = result;
          	}
          
          	public String getMessage() {
          		return message;
          	}
          
          	public void setMessage(String message) {
          		this.message = message;
          	}
          
          }
          
          package examples.teeda.web.add;
          
          public class AddResultPage {
          
          	private Integer arg1;
          
          	private Integer arg2;
          
          	private Integer result;
          
          	private String message;
          
          	public static final String jumpAddInput_TAKE_OVER = "type=never";
          
          	public void initialize() {
          		result = new Integer(arg1.intValue() + arg2.intValue());
          	}
          
          	public Integer getArg1() {
          		return arg1;
          	}
          
          	public void setArg1(Integer arg1) {
          		this.arg1 = arg1;
          	}
          
          	public Integer getArg2() {
          		return arg2;
          	}
          
          	public void setArg2(Integer arg2) {
          		this.arg2 = arg2;
          	}
          
          	public Integer getResult() {
          		return result;
          	}
          
          	public void setResult(Integer result) {
          		this.result = result;
          	}
          
          	public String getMessage() {
          		return message;
          	}
          
          	public void setMessage(String message) {
          		this.message = message;
          	}
          
          }
          

          もしかしたらこれが関係あるかもしれません.

          https://www.seasar.org/wiki/index.php?plugin=related&page=FAQ%2FTeeda

          shot added a comment - layoutなしの下記のプリミティブなコードで試してみました. 結果、大丈夫そうです. <html> <head> <meta http-equiv= "Content-Type" content= "text/html; charset=UTF-8" /> <title>Add</title> </head> <body> <form id= "addForm" > <input type= "hidden" id= "message-hidden" /> <div> <span id= "messages" ></span> </div> <span id= "message" >input and click seasar logo!</span> <table> <tr> <td></td><td><input type= "text" id= "arg1" /></td> <td><span id= "arg1Message" ></span></td> </tr> <tr> <td> + </td> <td><input type= "text" id= "arg2" /></td> <td><span id= "arg2Message" ></span></td> </tr> </table> <input type= "button" value= "calculate" id= "goAddResult" /> </form> </body> </html> public class AddInputPage { public static final String arg1_TRequiredValidator = null ; public static final String arg1_lengthValidator = "minimum=3" ; public static final String arg2_TRequiredValidator = null ; public static final String arg2_lengthValidator = "minimum=3" ; private Integer arg1; private Integer arg2; private Integer result; private String message; public String initialize() { message = "計算サンプル" ; return null ; } public void prerender() { arg2 = new Integer (999); } public Integer getArg1() { return arg1; } public void setArg1( Integer arg1) { this .arg1 = arg1; } public Integer getArg2() { return arg2; } public void setArg2( Integer arg2) { this .arg2 = arg2; } public Integer getResult() { return result; } public void setResult( Integer result) { this .result = result; } public String getMessage() { return message; } public void setMessage( String message) { this .message = message; } } package examples.teeda.web.add; public class AddResultPage { private Integer arg1; private Integer arg2; private Integer result; private String message; public static final String jumpAddInput_TAKE_OVER = "type=never" ; public void initialize() { result = new Integer (arg1.intValue() + arg2.intValue()); } public Integer getArg1() { return arg1; } public void setArg1( Integer arg1) { this .arg1 = arg1; } public Integer getArg2() { return arg2; } public void setArg2( Integer arg2) { this .arg2 = arg2; } public Integer getResult() { return result; } public void setResult( Integer result) { this .result = result; } public String getMessage() { return message; } public void setMessage( String message) { this .message = message; } } もしかしたらこれが関係あるかもしれません. https://www.seasar.org/wiki/index.php?plugin=related&page=FAQ%2FTeeda

            Assignee:
            shot
            Reporter:
            dewa
            Votes:
            0 Vote for this issue
            Watchers:
            Start watching this issue

              Created:
              Updated:
              Resolved: