You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by James Hays <ja...@mac.com> on 2003/08/08 17:31:14 UTC

Using components multiple times

I want to use a single conditional statement multiple times in the same 
page.  When doing this, I get this error:
"Template for component EditLevel contains multiple references to 
embedded component isNotNew"

This is true.  I have one conditional component specified and I am 
trying to use it twice.  I could create multiple conditional components 
in my .page file, but is this really needed? 

James


Re: Using components multiple times

Posted by Harish Krishnaswamy <hk...@comcast.net>.
I know there was some discussion about adding a conditional to all 
components, when that happens this would not be a problem. But for now I 
think the component IDs within a container should be unique.

-Harish

James Hays wrote:

> I want to use a single conditional statement multiple times in the 
> same page.  When doing this, I get this error:
> "Template for component EditLevel contains multiple references to 
> embedded component isNotNew"
>
> This is true.  I have one conditional component specified and I am 
> trying to use it twice.  I could create multiple conditional 
> components in my .page file, but is this really needed?
> James
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>


Re: Using components multiple times

Posted by James Hays <ja...@mac.com>.
I'm trying to wrap one Conditional element around several pieces of text 
in my HTML file without having several copies of the same Conditional 
component in my page specification.

Its just a convinience item.
Thanks.

James

Geoff Longman wrote:

>I don't understand what you are trying to do.
>
>Geoff
>----- Original Message -----
>From: "James Hays" <ja...@mac.com>
>To: "Tapestry users" <ta...@jakarta.apache.org>
>Sent: Friday, August 08, 2003 1:32 PM
>Subject: Re: Using components multiple times
>
>
>  
>
>>Yes, this is correct, but I can't imagine having 10 copies of a single
>>Conditional.  I can undertand this for form elements, but I think an
>>attribute to allow for multiple copies would be great to add to the
>>Conditional Component.
>>
>>Geoff Longman wrote:
>>
>>    
>>
>>>At the spec level (jwc files) you can use copy-of
>>>
>>><component id="MyCopy" copy-of="originalId"/>
>>>
>>>In templates you have to create a new one every time. ( I think)
>>>
>>>Geoff
>>>----- Original Message -----
>>>From: "James Hays" <ja...@mac.com>
>>>To: "Tapestry users" <ta...@jakarta.apache.org>
>>>Sent: Friday, August 08, 2003 11:31 AM
>>>Subject: Using components multiple times
>>>
>>>
>>>
>>>
>>>      
>>>
>>>>I want to use a single conditional statement multiple times in the same
>>>>page.  When doing this, I get this error:
>>>>"Template for component EditLevel contains multiple references to
>>>>embedded component isNotNew"
>>>>
>>>>This is true.  I have one conditional component specified and I am
>>>>trying to use it twice.  I could create multiple conditional components
>>>>in my .page file, but is this really needed?
>>>>
>>>>James
>>>>
>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>>
>>>>
>>>>
>>>>        
>>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>
>>>
>>>
>>>      
>>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>  
>

Re: Using components multiple times

Posted by Geoff Longman <gl...@intelligentworks.com>.
I don't understand what you are trying to do.

Geoff
----- Original Message -----
From: "James Hays" <ja...@mac.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Friday, August 08, 2003 1:32 PM
Subject: Re: Using components multiple times


> Yes, this is correct, but I can't imagine having 10 copies of a single
> Conditional.  I can undertand this for form elements, but I think an
> attribute to allow for multiple copies would be great to add to the
> Conditional Component.
>
> Geoff Longman wrote:
>
> >At the spec level (jwc files) you can use copy-of
> >
> ><component id="MyCopy" copy-of="originalId"/>
> >
> >In templates you have to create a new one every time. ( I think)
> >
> >Geoff
> >----- Original Message -----
> >From: "James Hays" <ja...@mac.com>
> >To: "Tapestry users" <ta...@jakarta.apache.org>
> >Sent: Friday, August 08, 2003 11:31 AM
> >Subject: Using components multiple times
> >
> >
> >
> >
> >>I want to use a single conditional statement multiple times in the same
> >>page.  When doing this, I get this error:
> >>"Template for component EditLevel contains multiple references to
> >>embedded component isNotNew"
> >>
> >>This is true.  I have one conditional component specified and I am
> >>trying to use it twice.  I could create multiple conditional components
> >>in my .page file, but is this really needed?
> >>
> >>James
> >>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >>
> >>
> >>
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
> >
>


Re: Using components multiple times

Posted by Vince Marco <vm...@mac.com>.
Same goes for Links.  I am running into situations where I have the 
same link at the top and bottom of a page.  Seems pretty bogus that 
they have to be named differently.

I'd rather see uniqueness enforced by the Form component on it's 
children, perhaps controlled by a parameter.  Unique IDs should not be 
a restriction of components in general.

Vince

On Friday, August 8, 2003, at 11:32  am, James Hays wrote:

> Yes, this is correct, but I can't imagine having 10 copies of a single 
> Conditional.  I can undertand this for form elements, but I think an 
> attribute to allow for multiple copies would be great to add to the 
> Conditional Component.
>


Re: Using components multiple times

Posted by James Hays <ja...@mac.com>.
Yes, this is correct, but I can't imagine having 10 copies of a single 
Conditional.  I can undertand this for form elements, but I think an 
attribute to allow for multiple copies would be great to add to the 
Conditional Component.

Geoff Longman wrote:

>At the spec level (jwc files) you can use copy-of
>
><component id="MyCopy" copy-of="originalId"/>
>
>In templates you have to create a new one every time. ( I think)
>
>Geoff
>----- Original Message ----- 
>From: "James Hays" <ja...@mac.com>
>To: "Tapestry users" <ta...@jakarta.apache.org>
>Sent: Friday, August 08, 2003 11:31 AM
>Subject: Using components multiple times
>
>
>  
>
>>I want to use a single conditional statement multiple times in the same 
>>page.  When doing this, I get this error:
>>"Template for component EditLevel contains multiple references to 
>>embedded component isNotNew"
>>
>>This is true.  I have one conditional component specified and I am 
>>trying to use it twice.  I could create multiple conditional components 
>>in my .page file, but is this really needed? 
>>
>>James
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>  
>

Re: Using components multiple times

Posted by Geoff Longman <gl...@intelligentworks.com>.
At the spec level (jwc files) you can use copy-of

<component id="MyCopy" copy-of="originalId"/>

In templates you have to create a new one every time. ( I think)

Geoff
----- Original Message ----- 
From: "James Hays" <ja...@mac.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Friday, August 08, 2003 11:31 AM
Subject: Using components multiple times


> I want to use a single conditional statement multiple times in the same 
> page.  When doing this, I get this error:
> "Template for component EditLevel contains multiple references to 
> embedded component isNotNew"
> 
> This is true.  I have one conditional component specified and I am 
> trying to use it twice.  I could create multiple conditional components 
> in my .page file, but is this really needed? 
> 
> James
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 


Re: Using components multiple times

Posted by John Meredith <ps...@t-online.de>.
You can't do that I'm afraid - a shortcoming, as component ids must be
unique within the component/page.

You can either put write out the conditional statement in your HTML
template using @Conditional and the condition parameter, or create a new
component, say @IsNew which just contains the condition, allows and
renders the body ie.

<span jwcid="isNew">
  <span jwcid="@RenderBody"/>
</span>

in your IsNew.html template.

In your new IsNew.jwc file you'd do something like:

<component-specification allow-body="yes">
  <component id="isNew" type="Condition">
	<binding name="condition" expression="your-condition"/>
  </component>
</component-specification>

You can then use it in your other components/pages.

It's a bit of a workaround, but can be quite useful.

  - John

On Fri, 2003-08-08 at 17:31, James Hays wrote:
> I want to use a single conditional statement multiple times in the same 
> page.  When doing this, I get this error:
> "Template for component EditLevel contains multiple references to 
> embedded component isNotNew"
> 
> This is true.  I have one conditional component specified and I am 
> trying to use it twice.  I could create multiple conditional components 
> in my .page file, but is this really needed? 
> 
> James
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
-- 
John Meredith <ps...@t-online.de>