You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by Alex Kwan <er...@hotmail.com> on 2003/11/18 04:28:42 UTC

Suggestion for Tapestry #1

Hi, All Dear Developers
    I have been using the Tapestry in my company's projects for a long time. Overall, tapestry is a brilliant project, and it do helps me alot. But I also found some problems that make the development not so easily. 
    Below, I will list these problems and give some suggestions.  

1. A true namespace mechanism
    Problems:    
Now, The tapestry handle the namespace problems like this: Each page or component can only access the pages and components that defined in the library specification and application specificaiton.For example, we defined lib1 and lib2 in the application specification, all the pages defined in the application specifition can access the pages in lib1 and lib2 like this: lib1:page1, lib2:page2. But if we want to access the pages defined in lib2 from the pages defined in lib1, we must add a lib2's library reference in the specification of lib1. Just like below:

Lib1 specification:

<library-specification>
 <library id="lib2" specification-path="lib2.library"/>
 <page name="page1" specification-path="page1.page"/>

</library-specification>

In lib1:page1:
    <span jwcid="@lib2:Component1"/>

This will cause two problems, first the namespace information is duplicated, we have already defined lib1 and lib2 in the application spec, why should we redefined them again in the lib spec? Secondly, What if we also want to acess the pages defined in the lib1 from the pages defined in lib2? Add a lib reference in lib2 spec? Deadlock occurs, this is a bug that exists in tapestry. This type of circular reference will cause the tapestry to lock. Instead, we had to redefine the page thant belongs to lib1 in the lib2 spec.

    Solutions:
We can use the mechanism like that java does: The application spec is the global namespace. We add all the reachable librarys to application spec. Each page or component can directly access the components and pages that imported in his specifition and access any page or component by the full qualified name.
For example:

Application spec

<library-specification>
 <library id="lib1" specification-path="lib1/lib1.library"/>
 <library id="lib1" specification-path="lib2/lib2.library"/>

 <page name="page1" specification-path="page1.page"/>
<componet id="componet1"/>
</library-specification>

 Lib1 spec
<library-specification>
 <page name="lib1-page1" specification-path="page1.page"/>
 <page name="lib1-page2" specification-path="page2.page"/>
<componet id="lib1-componet1"/>
</library-specification>

 Lib2 spec 
<library-specification>
    <library id="lib3" specification-path="lib3/lib3.library/>
 <page name="lib1-page1" specification-path="page1.page"/>
 <page name="lib1-page2" specification-path="page2.page"/>
<componet id="lib2-componet1"/>
</library-specification>

 Lib3 spec 
<library-specification>
 <page name="lib3-page1" specification-path="page1.page"/>
 <page name="lib3-page2" specification-path="page2.page"/>
<componet id="lib3-componet1"/>
</library-specification>


Now, in any page, we can do like this <span jwcid="lib2:lib3:lib3-component1"/> and in any page we can do getPage("lib1:lib-page1");

Hope I get this clear.

To be continued.


                                                                                                                                                            Alex