tapestry-user@jakarta.apache.org
[Top] [All Lists]

Re: Nested component question

Subject: Re: Nested component question
From: Ron Piterman
Date: Wed, 15 Jun 2005 15:21:00 +0300
You don't have to override renderPage for that. Infact what you do is setting the property after thew page was rendered... so its a bit too late ;-)

What you should do is pass the list as a parameter, rather than as a property. Then, in your page you do:

<span jwcid="myComponent" categories="categories"/>

in the class, you implement

public List getCategories() {
  getComponent(...).get...
}


Cheers,
Ron


××××× Vinicius Carvalho:
Hello there!
I have a page (Start.page) which has a List of categories objects.
This page has a component, with a nested component on it:

<span jwcid="@Border">
      <span jwcid="groupPanel" blockNames="ognl:user.groupList">
                <span jwcid="@CategoriesBorder"/>
      </span>
</span>

User is also a property from my page. And the categoriesBorder:

<component-specification class="org.apache.tapestry.BaseComponent"
allow-body="yes" allow-informal-parameters="no">
    <property-specification name="categories" type="java.util.List">
page.categories </property-specification> </component-specification>


<span jwcid="@Foreach" source="ognl:categories" element="category">
<table border="0" bgcolor="#FFFFFF" cellpadding="0" cellspacing="0"
width="85%" align="center">
                <tr>
            <td jwcid="@Any" element="td"
bgcolor="ognl:category.color" width="30%">
            <span jwcid="@Insert" value="ognl:category.title"/>
            </td>
            <td></td>
                </tr>
                <tr>
                        <td jwcid="@Any" element="td" bgcolor="ognl:category.color" 
width="100%">
                        <table cellspacing="1" width="100%">
                        <tr>
                                <td bgcolor="#FFFFFF" width="100%"> </td>
                        </tr>
                        </table>
                        </td>
                </tr>
</table>
<p><br>
</span>

Problem is, the categories is empty, null...
The page that contains the component (Start.page) has renderPage overriden
public void renderPage(IMarkupWriter arg0, IRequestCycle arg1) {
                super.renderPage(arg0, arg1);
                TabPanel tabPanel = (TabPanel)getComponent("groupPanel");
                Group group = (Group)tabPanel.getSelectedBlock();
                setCategories(getUserService().getCategories(group));
        }

I've debug it and the catetories have been set properly. Any ideas?

Thanks

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: tapestry-user-help@xxxxxxxxxxxxxxxxxx




---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: tapestry-user-help@xxxxxxxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>