You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by sky yjck <sk...@hotmail.com> on 2005/06/25 14:53:13 UTC
communicate between components
hi,list
I've some confused question about the communicate between components. Is
it impossible communicate between components without the page instance?
For example,I want to design a components structure with parent/children
relationship :
<span jwcid="ParentComponent" param1="a" param2="b">
<span jwcid="ChildComponent" value="a.name"/>
</span>
The "a" is an "out" direction parameter. If I want to use these
components in a page,I have to define a "a" property in the page :
<property name="a"/>
So,suppose my parent/child component is used in other component's
container :
<span jwcid="component1">
<span jwcid="component2">
<span jwcid="component3">
<span jwcid="ParentComponent" param1="a" param2="b">
<span jwcid="ChildComponent" value="a.name"/>
</span>
</span>
</span>
</span>
In the page of use "component1",I must define a "a" property
too,although the "a" property has no any relation with the page.
Or,suppose I use parent/child component times in a page:
<span jwcid="ParentComponent" param1="a1" param2="b">
<span jwcid="ChildComponent" value="a1.name"/>
</span>
<span jwcid="ParentComponent" param1="a2" param2="b">
<span jwcid="ChildComponent" value="a2.name"/>
</span>
<span jwcid="ParentComponent" param1="a3" param2="b">
<span jwcid="ChildComponent" value="a3.name"/>
</span>
I must define 'a1','a2','a3' in the page.
Can we just think about the "a" parameter as a "Local variable" or
"temporary variable"?Just like when we write the java codes:
public method(){
int a = getParameter(); <--- a temporary variable,I don't have to
define it in the class scope.
dosomething(a);
}
Have anyone feel inconvenience when you design a new compoent with
these requirement? I don't know if I ignore some important things of
tapestry.But I've check out the tapestry's build-in Foreach component's
source.I have to define a temporary property of the page when I use it.The
Foreach component has a "out" parameter too.
thx! :)
_________________________________________________________________
免费下载 MSN Explorer: http://explorer.msn.com/lccn/
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org