Hi all,

I am a newbie in Tapestry. Please, help me to understand, how binding of
parameters works. I'll show my problem on very simplified example.

There is a component:

public class BooleanComponent {

    @Parameter
    private Boolean value;

    boolean beginRender(MarkupWriter writer) {
        writer.write(""+value);
        return false;
    }
}

Component has one parameter of type Boolean, and all what component does
is rendering value of this parameter.

This component is placed on Page:
BooleanTestPage.tml:
<html xmlns="http://www.w3.org/1999/xhtml";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";
     xsi:schemaLocation="http://www.w3.org/2001/XMLSchema-instance
http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd";
        >

    <body>
        PageProperty: ${boolProperty} <br/>
        BooleanComponent: <t:booleanComponent t:value="boolProperty"/>
    </body>
</html>

BooleanTestPage.java:
public class BooleanTestPage {
    @Property
    private Boolean boolProperty;

    void onActivate(String yesNoNullStr) {
        if (yesNoNullStr.equalsIgnoreCase("yes"))
            boolProperty = true;
        else if (yesNoNullStr.equalsIgnoreCase("no"))
            boolProperty = false;
        else
            boolProperty = null;
    }
}

Page has property of type Boolean passed to component by parameter.

When I show the page with parameter "yes" or "no", everything goes
according to my expectations. Property of page and parameter of
component are binded, so they have same value, true or false.

But, when I show page with any other value, property of page gets null
value, but parameter of component gets false, not null. Why?
What am I doing wrong?


Regards
Lukasz


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to