You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Elankath, Tarun (Cognizant)" <ET...@blr.cognizant.com> on 2003/03/13 12:13:58 UTC

Why are multiple references to components not allowed ?

Hi list,

This is one thing that I have just not understood in Tapestry and it causes a great deal of  inconvenience for doing a number of simple things.

Sometimes a component needs be rendered in a page multiple times. Creating a new entry in the specification file, which simply calls the same methods in the page file is _so_ inconvenient.

Simple ex:

I have a tr where some rows are highlighted and others are not. They however display the _same_ content. The highlighting is achieved with the effect of a stylesheet class applied to the tr. Checking whether a given row needs to be highlighted or not is done with the conditional component. But, now for content of this highlighted TR I need to create separate references (new jwcid's) in the page specification file (lots of inserts), when it is the _same_ as the content of the normal TR.

Maybe there is a way after all and I have overlooked it ?

All help/pointers gratefully appreciated
Thanks,
Tarun





RE: Why are multiple references to components not allowed ?

Posted by "Howard M. Lewis Ship" <hl...@attbi.com>.
This is addressed in the next release using implicit components.  Implicit
components are fully declared in the template, with nothing in the page
specification.  For most primitive components such as Insert, Conditional
and Foreach, this works well enough.

Duplicating components goes against the grain of Tapestry.  I've been
thinking of bending the rules for certain components, such as Insert, that
do not contain a body.

However, you example could be improved.  Why not create a component that is
a "smart" version of the <tr> element that contains the logic for whether or
not to include the correct CSS class attribute?

--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/proposals/tapestry



> -----Original Message-----
> From: Elankath, Tarun (Cognizant) [mailto:ETarun@blr.cognizant.com] 
> Sent: Thursday, March 13, 2003 6:14 AM
> To: Tapestry users
> Subject: Why are multiple references to components not allowed ?
> 
> 
> Hi list,
> 
> This is one thing that I have just not understood in Tapestry 
> and it causes a great deal of  inconvenience for doing a 
> number of simple things.
> 
> Sometimes a component needs be rendered in a page multiple 
> times. Creating a new entry in the specification file, which 
> simply calls the same methods in the page file is _so_ inconvenient.
> 
> Simple ex:
> 
> I have a tr where some rows are highlighted and others are 
> not. They however display the _same_ content. The 
> highlighting is achieved with the effect of a stylesheet 
> class applied to the tr. Checking whether a given row needs 
> to be highlighted or not is done with the conditional 
> component. But, now for content of this highlighted TR I need 
> to create separate references (new jwcid's) in the page 
> specification file (lots of inserts), when it is the _same_ 
> as the content of the normal TR.
> 
> Maybe there is a way after all and I have overlooked it ?
> 
> All help/pointers gratefully appreciated
> Thanks,
> Tarun
> 
> 
> 
> 
>