Ugh.  This is a big pain now.  I have a huge dynamic form that has
lots of IFs, and I can see the same queries being called 3 times or
more.  =(
Everything still works, it's just about 3 times slower.

If anyone has solved this problem please let me know!

On 5/17/07, Daniel Jue <[EMAIL PROTECTED]> wrote:
Here is another example when more than one IF component is used.

It seems the conditional for the first IF gets called 3 times, then
the others just get called once.

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();

        @Component(type = "If", id = "ifABC", bindings = { 
"condition=getDoStuff()" })
        public abstract IComponent getIfABC();

        @Component(type = "If", id = "ifDEF", bindings = { 
"condition=getDoStuff()" })
        public abstract IComponent getIfDEF();

        @Component(type = "If", id = "ifGHI", bindings = { 
"condition=getDoStuff()" })
        public abstract IComponent getIfGHI();

        @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 XYZ</span>
<span jwcid="ifABC">Hi ABC</span>
<span jwcid="ifDEF">Hi DEF</span>
<span jwcid="ifGHI">Hi GHI</span>
<span jwcid="wtfisgoingon" />
</body>
</html>


plain.page is an empty page spec.

Output:
INFO: Server startup in 3645 ms
plain: getDoStuff() 1
plain: getDoStuff() 2
plain: getDoStuff() 3
plain: getDoStuff() 4
plain: getDoStuff() 5
plain: getDoStuff() 6


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to