You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Scott Swank <sc...@gmail.com> on 2009/03/26 22:39:35 UTC

Re: HTML can't reference a component (Label) multiple times?

Surprisingly getDebugSettings().setComponentUseCheck(false) allows
this behavior, at least on 1.3.

   add(new Label("authorName"));

   <span wicket:id="authorName"></span>
   <span wicket:id="authorName"></span>

... not that I'm advocating this side effect.

Scott


On Fri, Feb 13, 2009 at 10:26 AM, Igor Vaynberg <ig...@gmail.com> wrote:
> not to mention it doesnt make sense for a lot of usecases, eg
> setoutputmarkupid() if you call it then the two rendered components
> will have the same markup id - whoops. which means this will break
> javascript, ajax, etc, etc.
>
> -igor
>
> On Fri, Feb 13, 2009 at 2:59 AM, Martijn Dashorst
> <ma...@gmail.com> wrote:
>> 99.99% of the time this is an error: a component is referenced
>> multiple times in markup. Therefore we don't allow one component to be
>> rendering in multiple places. For that 0.01% of useful cases, it is
>> not too difficult to just add the label component twice.
>>
>> Martijn
>>
>>
>> On Thu, Feb 12, 2009 at 8:54 PM, Phil Grimm <ph...@gmail.com> wrote:
>>> Guys,
>>>
>>> If I need to reference a Label multiple times on the page.
>>> Is there a better way than creating multiple redundant but distinct labels?
>>>
>>> Is this the only option?
>>>
>>> add(new Label("authorName1"));
>>> add(new Label("authorName2"));
>>> add(new Label("authorName3"));
>>>
>>> <span wicket:id="authorName1"></span>
>>> <span wicket:id="authorName2"></span>
>>> <span wicket:id="authorName3"></span>
>>>
>>> This (non-one-to-one) usage...
>>>
>>> add(new Label("authorName"));
>>>
>>> <span wicket:id="authorName"></span>
>>> <span wicket:id="authorName"></span>
>>>
>>> ... causes error:
>>>
>>> WicketMessage: The component [Component id = author.name] has the same
>>> wicket:id as another component already added at the same level
>>>
>>>
>>> Phil
>>>
>>> --
>>> Phil Grimm
>>> Mobile: (858) 335-3426
>>> Skype: philgrimm336
>>>
>>
>>
>>
>> --
>> Become a Wicket expert, learn from the best: http://wicketinaction.com
>> Apache Wicket 1.3.5 is released
>> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: HTML can't reference a component (Label) multiple times?

Posted by Jeremy Thomerson <je...@wickettraining.com>.
I think it is accepted and should be left that way.  By default in
development, component use check is on - so you should catch these unless
you're explicitly ignoring them by turning CUC off.

--
Jeremy Thomerson
http://www.wickettraining.com



On Thu, Mar 26, 2009 at 4:41 PM, Scott Swank <sc...@gmail.com> wrote:

> Should I open a JIRA for this, or is this an accepted side-effect?
>
> Scott
>
>
> On Thu, Mar 26, 2009 at 2:39 PM, Scott Swank <sc...@gmail.com>
> wrote:
> > Surprisingly getDebugSettings().setComponentUseCheck(false) allows
> > this behavior, at least on 1.3.
> >
> >   add(new Label("authorName"));
> >
> >   <span wicket:id="authorName"></span>
> >   <span wicket:id="authorName"></span>
> >
> > ... not that I'm advocating this side effect.
> >
> > Scott
> >
> >
> > On Fri, Feb 13, 2009 at 10:26 AM, Igor Vaynberg <ig...@gmail.com>
> wrote:
> >> not to mention it doesnt make sense for a lot of usecases, eg
> >> setoutputmarkupid() if you call it then the two rendered components
> >> will have the same markup id - whoops. which means this will break
> >> javascript, ajax, etc, etc.
> >>
> >> -igor
> >>
> >> On Fri, Feb 13, 2009 at 2:59 AM, Martijn Dashorst
> >> <ma...@gmail.com> wrote:
> >>> 99.99% of the time this is an error: a component is referenced
> >>> multiple times in markup. Therefore we don't allow one component to be
> >>> rendering in multiple places. For that 0.01% of useful cases, it is
> >>> not too difficult to just add the label component twice.
> >>>
> >>> Martijn
> >>>
> >>>
> >>> On Thu, Feb 12, 2009 at 8:54 PM, Phil Grimm <ph...@gmail.com>
> wrote:
> >>>> Guys,
> >>>>
> >>>> If I need to reference a Label multiple times on the page.
> >>>> Is there a better way than creating multiple redundant but distinct
> labels?
> >>>>
> >>>> Is this the only option?
> >>>>
> >>>> add(new Label("authorName1"));
> >>>> add(new Label("authorName2"));
> >>>> add(new Label("authorName3"));
> >>>>
> >>>> <span wicket:id="authorName1"></span>
> >>>> <span wicket:id="authorName2"></span>
> >>>> <span wicket:id="authorName3"></span>
> >>>>
> >>>> This (non-one-to-one) usage...
> >>>>
> >>>> add(new Label("authorName"));
> >>>>
> >>>> <span wicket:id="authorName"></span>
> >>>> <span wicket:id="authorName"></span>
> >>>>
> >>>> ... causes error:
> >>>>
> >>>> WicketMessage: The component [Component id = author.name] has the
> same
> >>>> wicket:id as another component already added at the same level
> >>>>
> >>>>
> >>>> Phil
> >>>>
> >>>> --
> >>>> Phil Grimm
> >>>> Mobile: (858) 335-3426
> >>>> Skype: philgrimm336
> >>>>
> >>>
> >>>
> >>>
> >>> --
> >>> Become a Wicket expert, learn from the best: http://wicketinaction.com
> >>> Apache Wicket 1.3.5 is released
> >>> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>
> >>>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: HTML can't reference a component (Label) multiple times?

Posted by Scott Swank <sc...@gmail.com>.
Should I open a JIRA for this, or is this an accepted side-effect?

Scott


On Thu, Mar 26, 2009 at 2:39 PM, Scott Swank <sc...@gmail.com> wrote:
> Surprisingly getDebugSettings().setComponentUseCheck(false) allows
> this behavior, at least on 1.3.
>
>   add(new Label("authorName"));
>
>   <span wicket:id="authorName"></span>
>   <span wicket:id="authorName"></span>
>
> ... not that I'm advocating this side effect.
>
> Scott
>
>
> On Fri, Feb 13, 2009 at 10:26 AM, Igor Vaynberg <ig...@gmail.com> wrote:
>> not to mention it doesnt make sense for a lot of usecases, eg
>> setoutputmarkupid() if you call it then the two rendered components
>> will have the same markup id - whoops. which means this will break
>> javascript, ajax, etc, etc.
>>
>> -igor
>>
>> On Fri, Feb 13, 2009 at 2:59 AM, Martijn Dashorst
>> <ma...@gmail.com> wrote:
>>> 99.99% of the time this is an error: a component is referenced
>>> multiple times in markup. Therefore we don't allow one component to be
>>> rendering in multiple places. For that 0.01% of useful cases, it is
>>> not too difficult to just add the label component twice.
>>>
>>> Martijn
>>>
>>>
>>> On Thu, Feb 12, 2009 at 8:54 PM, Phil Grimm <ph...@gmail.com> wrote:
>>>> Guys,
>>>>
>>>> If I need to reference a Label multiple times on the page.
>>>> Is there a better way than creating multiple redundant but distinct labels?
>>>>
>>>> Is this the only option?
>>>>
>>>> add(new Label("authorName1"));
>>>> add(new Label("authorName2"));
>>>> add(new Label("authorName3"));
>>>>
>>>> <span wicket:id="authorName1"></span>
>>>> <span wicket:id="authorName2"></span>
>>>> <span wicket:id="authorName3"></span>
>>>>
>>>> This (non-one-to-one) usage...
>>>>
>>>> add(new Label("authorName"));
>>>>
>>>> <span wicket:id="authorName"></span>
>>>> <span wicket:id="authorName"></span>
>>>>
>>>> ... causes error:
>>>>
>>>> WicketMessage: The component [Component id = author.name] has the same
>>>> wicket:id as another component already added at the same level
>>>>
>>>>
>>>> Phil
>>>>
>>>> --
>>>> Phil Grimm
>>>> Mobile: (858) 335-3426
>>>> Skype: philgrimm336
>>>>
>>>
>>>
>>>
>>> --
>>> Become a Wicket expert, learn from the best: http://wicketinaction.com
>>> Apache Wicket 1.3.5 is released
>>> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org