Maybe a Delegate can help you here.

Uli

Am 14.05.2009 10:45 schrieb Borut Bolčina:
Hi,

I am trying to set the layout dynamically, but I guess this can not be done.
The t:type="${layout}" does not get expanded to whatever I set in
Index.java.

PageWithLayout.tml
===============
<div t:type="${layout}" xmlns:t="
http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
    <p>page with ${layout}</p>
</div>

PageWithLayout.java
===============
public class PageWithLayout {

    private String layout;

    public String getLayout() {
        return layout;
    }

    public void setLayout(String layout) {
        this.layout = layout;
    }
}

Index.tml
=======
<t:actionlink t:id="PageWithLayout1">layout1</t:actionlink><br/>
<t:actionlink t:id="PageWithLayout2">layout2</t:actionlink>

Index.java
=======
public class Index {
    @InjectPage
    private PageWithLayout pageWithLayout;

    Object onActionFromPageWithLayout1() {
        pageWithLayout.setLayout("layout1");
        return pageWithLayout;
    }

    Object onActionFromPageWithLayout2() {
        pageWithLayout.setLayout("layout2");
        return pageWithLayout;
    }
}

-Borut



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

Reply via email to