Tapestry
  1. Tapestry
  2. TAPESTRY-1477

IF component's condition expression get evaluated 3 or more times when it should only be evaluated once.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 4.1.2
    • Fix Version/s: 4.1.2
    • Component/s: Core Components
    • Labels:
      None
    • Environment:
      At least since 4.1.2-20070501.233137-64, but an old 4.1.2-20070215.051249-15 worked correctly.
      Java 1.5, Tomcat 5.5.23 (should not matter), caching off. IE 6 and Firefox 2 on XP Pro.

      Description

      I've simplified the problem code even
      more, to eliminate any confusion:

      plain.java:
      package com.phy6.app;

      import org.apache.tapestry.IComponent;
      import org.apache.tapestry.annotations.Component;
      import org.apache.tapestry.annotations.InitialValue;
      import org.apache.tapestry.html.BasePage;

      public abstract class plain extends BasePage {

      public boolean getDoStuff()

      { this.setNumber(this.getNumber() + 1); System.out.println("plain: getDoStuff() " + this.getNumber()); return false; }

      @Component(type = "If", id = "ifXYZ", bindings =

      { "condition=getDoStuff()" }

      )
      public abstract IComponent getIfXYZ();

      @InitialValue("0")
      public abstract int getNumber();

      @Component(type="Insert",id="wtfisgoingon",bindings=

      {"value=getNumber()"}

      )
      public abstract IComponent getWTFisgoingon();
      public abstract void setNumber(int n);
      }

      plain.html:

      <html>
      <body>
      <span jwcid="ifXYZ">Hi</span>
      <span jwcid="wtfisgoingon" />
      </body>
      </html>

      plain.page is still an empty page spec.

      Same output:

      May 17, 2007 1:57:40 PM org.apache.catalina.startup.Catalina start
      INFO: Server startup in 5328 ms
      plain: getDoStuff() 1
      plain: getDoStuff() 2
      plain: getDoStuff() 3

      Expected output:
      plain: getDoStuff() 1

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Unassigned
            Reporter:
            Daniel Jue
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development