You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by novotny <no...@gridsphere.org> on 2008/12/11 21:57:05 UTC

how to reuse a label in the same page?


I have a simple label "hello" and I want to display it twice in the same
page, but wicket complains the wicket:id needs to be unique in my page....
what do I need to do, is there an alias or something?

Thanks, Jason
-- 
View this message in context: http://www.nabble.com/how-to-reuse-a-label-in-the-same-page--tp20964351p20964351.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: how to reuse a label in the same page?

Posted by James Carman <ja...@carmanconsulting.com>.
Create multiple copies.

On Thu, Dec 11, 2008 at 3:57 PM, novotny <no...@gridsphere.org> wrote:
>
>
> I have a simple label "hello" and I want to display it twice in the same
> page, but wicket complains the wicket:id needs to be unique in my page....
> what do I need to do, is there an alias or something?
>
> Thanks, Jason
> --
> View this message in context: http://www.nabble.com/how-to-reuse-a-label-in-the-same-page--tp20964351p20964351.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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: how to reuse a label in the same page?

Posted by Igor Vaynberg <ig...@gmail.com>.
what happens once you add a behavior that uses markup id? or even call
setoutputmarkupid(true) on that component?

-igor

On Fri, Dec 12, 2008 at 9:35 AM, Jeremy Thomerson
<je...@wickettraining.com> wrote:
> Oops - you are right there - the component use check was turned off in this
> app (I just threw the example into an existing app to test it).
>
> While I don't typically use this, or have this use case, I'm not clear on
> what is "fundamentally wrong" with this - you have a component you want two
> places in a page or panel, etc...  So, why mustyou create two duplicate
> components?  That seems more wrong than the former.
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>
>
> On Fri, Dec 12, 2008 at 11:23 AM, Martijn Dashorst <
> martijn.dashorst@gmail.com> wrote:
>
>> Now run your application in virgin development mode. The fact that we
>> disable the component use check in production mode doesn't make it
>> less evil.
>>
>> Martijn
>>
>> On Fri, Dec 12, 2008 at 5:56 PM, Jeremy Thomerson
>>  <je...@wickettraining.com> wrote:
>> > Martijn,
>> > Actually, what I described does work - try this on any page:
>> >
>> > JAVA (added only once - since you couldn't add two with the same ID
>> anyway):
>> > add(new Label("test", "this is a test"));
>> >
>> > HTML:
>> > <span wicket:id="test">[]</span><br />
>> > <span wicket:id="test">[]</span><br />
>> >
>> > OUTPUT:
>> > <span wicket:id="test">this is a test</span><br />
>> > <span wicket:id="test">this is a test</span><br />
>> > Right or wrong, it currently works that way.  (1.4-SNAPSHOT - and I know
>> > I've used it in past versions as well)
>> > --
>> > Jeremy Thomerson
>> > http://www.wickettraining.com
>> >
>> >
>> > On Fri, Dec 12, 2008 at 1:17 AM, Martijn Dashorst <
>> > martijn.dashorst@gmail.com> wrote:
>> >
>> >> Nope, wicket:id is a 1-1 mapping at the same dom tree level. You can
>> >> reuse id's at different levels or in different branches of the dom
>> >> tree, but not as siblings.
>> >>
>> >> <a href="#" wicket:id="foo"><span wicket:id="foo"></span></a> works
>> >> but another
>> >> <a href="#" wicket:id="foo">....</a> will fail (and rightfully so)
>> >>
>> >> Martijn
>> >>
>> >> On Fri, Dec 12, 2008 at 6:20 AM, Jeremy Thomerson
>> >> <je...@wickettraining.com> wrote:
>> >> > I'm pretty sure that you can just add it once in Java and multiple
>> times
>> >> in
>> >> > the HTML, although I've never pondered the (potential) side-effects of
>> >> > this.  Give it a shot and let us know how it works for you.  With
>> >> something
>> >> > as stateless / simple as a BookmarkablePageLink, there probably
>> couldn't
>> >> be
>> >> > much in the way of side-effects, although with very complex, stateful
>> >> > components, I could see that maybe there would be an issue...
>> (maybe??)
>> >> > --
>> >> > Jeremy Thomerson
>> >> > http://www.wickettraining.com
>> >> >
>> >> >
>> >> > On Thu, Dec 11, 2008 at 3:29 PM, novotny <no...@gridsphere.org>
>> wrote:
>> >> >
>> >> >>
>> >> >>
>> >> >> Basically I need two of the same links on the page, and it looks like
>> I
>> >> >> have
>> >> >> to do this which just seems kinda lame...
>> >> >>
>> >> >> add(new BookmarkablePageLink<String>("personaldetails",
>> >> >> PersonalDetailsPage.class));
>> >> >> add(new BookmarkablePageLink<String>("personaldetails2",
>> >> >> PersonalDetailsPage.class));
>> >> >>
>> >> >> ....
>> >> >>
>> >> >> Click Here
>> >> >> Profile page
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >> jWeekend wrote:
>> >> >> >
>> >> >> > Jason,
>> >> >> >
>> >> >> > What are you trying to achieve?
>> >> >> >
>> >> >> > Here are some ideas that may give the desired effect, depending on
>> >> what
>> >> >> > that is ...
>> >> >> >
>> >> >> > 1 - Make a model for your data and give that to all the Label
>> >> instances
>> >> >> as
>> >> >> > required, (but each with their unique id and separate markup).
>> >> >> > 2 - Use a repeater (like a ListView) to render several labels (no
>> >> >> > repetition of Java code or markup).
>> >> >> > 3 - Write a method that takes a model (or just a String) and an id,
>> >> that
>> >> >> > returns an appropriately configured Label instance  (saves on
>> >> repeating
>> >> >> > Java code - still need markup per component and your own unique
>> ids).
>> >> >> >
>> >> >> > Regards - Cemal
>> >> >> >  http://www.jWeekend.co.uk <http://www.jweekend.co.uk/> <
>> http://www.jweekend.co.uk/> <
>> >> http://www.jweekend.co.uk/> jWeekend
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > novotny wrote:
>> >> >> >>
>> >> >> >>
>> >> >> >> I have a simple label "hello" and I want to display it twice in
>> the
>> >> same
>> >> >> >> page, but wicket complains the wicket:id needs to be unique in my
>> >> >> >> page.... what do I need to do, is there an alias or something?
>> >> >> >>
>> >> >> >> Thanks, Jason
>> >> >> >>
>> >> >> >
>> >> >> >
>> >> >>
>> >> >> --
>> >> >> View this message in context:
>> >> >>
>> >>
>> http://www.nabble.com/how-to-reuse-a-label-in-the-same-page--tp20964351p20964551.html
>> >> >>  Sent from the Wicket - User mailing list archive at Nabble.com.
>> >> >>
>> >> >>
>> >> >> ---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >> >>
>> >> >>
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Become a Wicket expert, learn from the best: http://wicketinaction.com
>> >> Apache Wicket 1.3.4 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
>> >>
>> >>
>> >
>>
>>
>>
>> --
>>  Become a Wicket expert, learn from the best: http://wicketinaction.com
>> Apache Wicket 1.3.4 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


Re: how to reuse a label in the same page?

Posted by Jeremy Thomerson <je...@wickettraining.com>.
Oops - you are right there - the component use check was turned off in this
app (I just threw the example into an existing app to test it).

While I don't typically use this, or have this use case, I'm not clear on
what is "fundamentally wrong" with this - you have a component you want two
places in a page or panel, etc...  So, why mustyou create two duplicate
components?  That seems more wrong than the former.

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


On Fri, Dec 12, 2008 at 11:23 AM, Martijn Dashorst <
martijn.dashorst@gmail.com> wrote:

> Now run your application in virgin development mode. The fact that we
> disable the component use check in production mode doesn't make it
> less evil.
>
> Martijn
>
> On Fri, Dec 12, 2008 at 5:56 PM, Jeremy Thomerson
>  <je...@wickettraining.com> wrote:
> > Martijn,
> > Actually, what I described does work - try this on any page:
> >
> > JAVA (added only once - since you couldn't add two with the same ID
> anyway):
> > add(new Label("test", "this is a test"));
> >
> > HTML:
> > <span wicket:id="test">[]</span><br />
> > <span wicket:id="test">[]</span><br />
> >
> > OUTPUT:
> > <span wicket:id="test">this is a test</span><br />
> > <span wicket:id="test">this is a test</span><br />
> > Right or wrong, it currently works that way.  (1.4-SNAPSHOT - and I know
> > I've used it in past versions as well)
> > --
> > Jeremy Thomerson
> > http://www.wickettraining.com
> >
> >
> > On Fri, Dec 12, 2008 at 1:17 AM, Martijn Dashorst <
> > martijn.dashorst@gmail.com> wrote:
> >
> >> Nope, wicket:id is a 1-1 mapping at the same dom tree level. You can
> >> reuse id's at different levels or in different branches of the dom
> >> tree, but not as siblings.
> >>
> >> <a href="#" wicket:id="foo"><span wicket:id="foo"></span></a> works
> >> but another
> >> <a href="#" wicket:id="foo">....</a> will fail (and rightfully so)
> >>
> >> Martijn
> >>
> >> On Fri, Dec 12, 2008 at 6:20 AM, Jeremy Thomerson
> >> <je...@wickettraining.com> wrote:
> >> > I'm pretty sure that you can just add it once in Java and multiple
> times
> >> in
> >> > the HTML, although I've never pondered the (potential) side-effects of
> >> > this.  Give it a shot and let us know how it works for you.  With
> >> something
> >> > as stateless / simple as a BookmarkablePageLink, there probably
> couldn't
> >> be
> >> > much in the way of side-effects, although with very complex, stateful
> >> > components, I could see that maybe there would be an issue...
> (maybe??)
> >> > --
> >> > Jeremy Thomerson
> >> > http://www.wickettraining.com
> >> >
> >> >
> >> > On Thu, Dec 11, 2008 at 3:29 PM, novotny <no...@gridsphere.org>
> wrote:
> >> >
> >> >>
> >> >>
> >> >> Basically I need two of the same links on the page, and it looks like
> I
> >> >> have
> >> >> to do this which just seems kinda lame...
> >> >>
> >> >> add(new BookmarkablePageLink<String>("personaldetails",
> >> >> PersonalDetailsPage.class));
> >> >> add(new BookmarkablePageLink<String>("personaldetails2",
> >> >> PersonalDetailsPage.class));
> >> >>
> >> >> ....
> >> >>
> >> >> Click Here
> >> >> Profile page
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >> jWeekend wrote:
> >> >> >
> >> >> > Jason,
> >> >> >
> >> >> > What are you trying to achieve?
> >> >> >
> >> >> > Here are some ideas that may give the desired effect, depending on
> >> what
> >> >> > that is ...
> >> >> >
> >> >> > 1 - Make a model for your data and give that to all the Label
> >> instances
> >> >> as
> >> >> > required, (but each with their unique id and separate markup).
> >> >> > 2 - Use a repeater (like a ListView) to render several labels (no
> >> >> > repetition of Java code or markup).
> >> >> > 3 - Write a method that takes a model (or just a String) and an id,
> >> that
> >> >> > returns an appropriately configured Label instance  (saves on
> >> repeating
> >> >> > Java code - still need markup per component and your own unique
> ids).
> >> >> >
> >> >> > Regards - Cemal
> >> >> >  http://www.jWeekend.co.uk <http://www.jweekend.co.uk/> <
> http://www.jweekend.co.uk/> <
> >> http://www.jweekend.co.uk/> jWeekend
> >> >> >
> >> >> >
> >> >> >
> >> >> > novotny wrote:
> >> >> >>
> >> >> >>
> >> >> >> I have a simple label "hello" and I want to display it twice in
> the
> >> same
> >> >> >> page, but wicket complains the wicket:id needs to be unique in my
> >> >> >> page.... what do I need to do, is there an alias or something?
> >> >> >>
> >> >> >> Thanks, Jason
> >> >> >>
> >> >> >
> >> >> >
> >> >>
> >> >> --
> >> >> View this message in context:
> >> >>
> >>
> http://www.nabble.com/how-to-reuse-a-label-in-the-same-page--tp20964351p20964551.html
> >> >>  Sent from the Wicket - User mailing list archive at Nabble.com.
> >> >>
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> >> For additional commands, e-mail: users-help@wicket.apache.org
> >> >>
> >> >>
> >> >
> >>
> >>
> >>
> >> --
> >> Become a Wicket expert, learn from the best: http://wicketinaction.com
> >> Apache Wicket 1.3.4 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
> >>
> >>
> >
>
>
>
> --
>  Become a Wicket expert, learn from the best: http://wicketinaction.com
> Apache Wicket 1.3.4 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
>
>

Re: how to reuse a label in the same page?

Posted by Martijn Dashorst <ma...@gmail.com>.
Now run your application in virgin development mode. The fact that we
disable the component use check in production mode doesn't make it
less evil.

Martijn

On Fri, Dec 12, 2008 at 5:56 PM, Jeremy Thomerson
<je...@wickettraining.com> wrote:
> Martijn,
> Actually, what I described does work - try this on any page:
>
> JAVA (added only once - since you couldn't add two with the same ID anyway):
> add(new Label("test", "this is a test"));
>
> HTML:
> <span wicket:id="test">[]</span><br />
> <span wicket:id="test">[]</span><br />
>
> OUTPUT:
> <span wicket:id="test">this is a test</span><br />
> <span wicket:id="test">this is a test</span><br />
> Right or wrong, it currently works that way.  (1.4-SNAPSHOT - and I know
> I've used it in past versions as well)
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>
>
> On Fri, Dec 12, 2008 at 1:17 AM, Martijn Dashorst <
> martijn.dashorst@gmail.com> wrote:
>
>> Nope, wicket:id is a 1-1 mapping at the same dom tree level. You can
>> reuse id's at different levels or in different branches of the dom
>> tree, but not as siblings.
>>
>> <a href="#" wicket:id="foo"><span wicket:id="foo"></span></a> works
>> but another
>> <a href="#" wicket:id="foo">....</a> will fail (and rightfully so)
>>
>> Martijn
>>
>> On Fri, Dec 12, 2008 at 6:20 AM, Jeremy Thomerson
>> <je...@wickettraining.com> wrote:
>> > I'm pretty sure that you can just add it once in Java and multiple times
>> in
>> > the HTML, although I've never pondered the (potential) side-effects of
>> > this.  Give it a shot and let us know how it works for you.  With
>> something
>> > as stateless / simple as a BookmarkablePageLink, there probably couldn't
>> be
>> > much in the way of side-effects, although with very complex, stateful
>> > components, I could see that maybe there would be an issue... (maybe??)
>> > --
>> > Jeremy Thomerson
>> > http://www.wickettraining.com
>> >
>> >
>> > On Thu, Dec 11, 2008 at 3:29 PM, novotny <no...@gridsphere.org> wrote:
>> >
>> >>
>> >>
>> >> Basically I need two of the same links on the page, and it looks like I
>> >> have
>> >> to do this which just seems kinda lame...
>> >>
>> >> add(new BookmarkablePageLink<String>("personaldetails",
>> >> PersonalDetailsPage.class));
>> >> add(new BookmarkablePageLink<String>("personaldetails2",
>> >> PersonalDetailsPage.class));
>> >>
>> >> ....
>> >>
>> >> Click Here
>> >> Profile page
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> jWeekend wrote:
>> >> >
>> >> > Jason,
>> >> >
>> >> > What are you trying to achieve?
>> >> >
>> >> > Here are some ideas that may give the desired effect, depending on
>> what
>> >> > that is ...
>> >> >
>> >> > 1 - Make a model for your data and give that to all the Label
>> instances
>> >> as
>> >> > required, (but each with their unique id and separate markup).
>> >> > 2 - Use a repeater (like a ListView) to render several labels (no
>> >> > repetition of Java code or markup).
>> >> > 3 - Write a method that takes a model (or just a String) and an id,
>> that
>> >> > returns an appropriately configured Label instance  (saves on
>> repeating
>> >> > Java code - still need markup per component and your own unique ids).
>> >> >
>> >> > Regards - Cemal
>> >> >  http://www.jWeekend.co.uk <http://www.jweekend.co.uk/> <
>> http://www.jweekend.co.uk/> jWeekend
>> >> >
>> >> >
>> >> >
>> >> > novotny wrote:
>> >> >>
>> >> >>
>> >> >> I have a simple label "hello" and I want to display it twice in the
>> same
>> >> >> page, but wicket complains the wicket:id needs to be unique in my
>> >> >> page.... what do I need to do, is there an alias or something?
>> >> >>
>> >> >> Thanks, Jason
>> >> >>
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/how-to-reuse-a-label-in-the-same-page--tp20964351p20964551.html
>> >>  Sent from the Wicket - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >>
>> >>
>> >
>>
>>
>>
>> --
>> Become a Wicket expert, learn from the best: http://wicketinaction.com
>> Apache Wicket 1.3.4 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
>>
>>
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.4 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


Re: how to reuse a label in the same page?

Posted by Jeremy Thomerson <je...@wickettraining.com>.
Martijn,
Actually, what I described does work - try this on any page:

JAVA (added only once - since you couldn't add two with the same ID anyway):
add(new Label("test", "this is a test"));

HTML:
<span wicket:id="test">[]</span><br />
<span wicket:id="test">[]</span><br />

OUTPUT:
<span wicket:id="test">this is a test</span><br />
<span wicket:id="test">this is a test</span><br />
Right or wrong, it currently works that way.  (1.4-SNAPSHOT - and I know
I've used it in past versions as well)
-- 
Jeremy Thomerson
http://www.wickettraining.com


On Fri, Dec 12, 2008 at 1:17 AM, Martijn Dashorst <
martijn.dashorst@gmail.com> wrote:

> Nope, wicket:id is a 1-1 mapping at the same dom tree level. You can
> reuse id's at different levels or in different branches of the dom
> tree, but not as siblings.
>
> <a href="#" wicket:id="foo"><span wicket:id="foo"></span></a> works
> but another
> <a href="#" wicket:id="foo">....</a> will fail (and rightfully so)
>
> Martijn
>
> On Fri, Dec 12, 2008 at 6:20 AM, Jeremy Thomerson
> <je...@wickettraining.com> wrote:
> > I'm pretty sure that you can just add it once in Java and multiple times
> in
> > the HTML, although I've never pondered the (potential) side-effects of
> > this.  Give it a shot and let us know how it works for you.  With
> something
> > as stateless / simple as a BookmarkablePageLink, there probably couldn't
> be
> > much in the way of side-effects, although with very complex, stateful
> > components, I could see that maybe there would be an issue... (maybe??)
> > --
> > Jeremy Thomerson
> > http://www.wickettraining.com
> >
> >
> > On Thu, Dec 11, 2008 at 3:29 PM, novotny <no...@gridsphere.org> wrote:
> >
> >>
> >>
> >> Basically I need two of the same links on the page, and it looks like I
> >> have
> >> to do this which just seems kinda lame...
> >>
> >> add(new BookmarkablePageLink<String>("personaldetails",
> >> PersonalDetailsPage.class));
> >> add(new BookmarkablePageLink<String>("personaldetails2",
> >> PersonalDetailsPage.class));
> >>
> >> ....
> >>
> >> Click Here
> >> Profile page
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >> jWeekend wrote:
> >> >
> >> > Jason,
> >> >
> >> > What are you trying to achieve?
> >> >
> >> > Here are some ideas that may give the desired effect, depending on
> what
> >> > that is ...
> >> >
> >> > 1 - Make a model for your data and give that to all the Label
> instances
> >> as
> >> > required, (but each with their unique id and separate markup).
> >> > 2 - Use a repeater (like a ListView) to render several labels (no
> >> > repetition of Java code or markup).
> >> > 3 - Write a method that takes a model (or just a String) and an id,
> that
> >> > returns an appropriately configured Label instance  (saves on
> repeating
> >> > Java code - still need markup per component and your own unique ids).
> >> >
> >> > Regards - Cemal
> >> >  http://www.jWeekend.co.uk <http://www.jweekend.co.uk/> <
> http://www.jweekend.co.uk/> jWeekend
> >> >
> >> >
> >> >
> >> > novotny wrote:
> >> >>
> >> >>
> >> >> I have a simple label "hello" and I want to display it twice in the
> same
> >> >> page, but wicket complains the wicket:id needs to be unique in my
> >> >> page.... what do I need to do, is there an alias or something?
> >> >>
> >> >> Thanks, Jason
> >> >>
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/how-to-reuse-a-label-in-the-same-page--tp20964351p20964551.html
> >>  Sent from the Wicket - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >
>
>
>
> --
> Become a Wicket expert, learn from the best: http://wicketinaction.com
> Apache Wicket 1.3.4 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
>
>

Re: how to reuse a label in the same page?

Posted by Martijn Dashorst <ma...@gmail.com>.
Nope, wicket:id is a 1-1 mapping at the same dom tree level. You can
reuse id's at different levels or in different branches of the dom
tree, but not as siblings.

<a href="#" wicket:id="foo"><span wicket:id="foo"></span></a> works
but another
<a href="#" wicket:id="foo">....</a> will fail (and rightfully so)

Martijn

On Fri, Dec 12, 2008 at 6:20 AM, Jeremy Thomerson
<je...@wickettraining.com> wrote:
> I'm pretty sure that you can just add it once in Java and multiple times in
> the HTML, although I've never pondered the (potential) side-effects of
> this.  Give it a shot and let us know how it works for you.  With something
> as stateless / simple as a BookmarkablePageLink, there probably couldn't be
> much in the way of side-effects, although with very complex, stateful
> components, I could see that maybe there would be an issue... (maybe??)
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>
>
> On Thu, Dec 11, 2008 at 3:29 PM, novotny <no...@gridsphere.org> wrote:
>
>>
>>
>> Basically I need two of the same links on the page, and it looks like I
>> have
>> to do this which just seems kinda lame...
>>
>> add(new BookmarkablePageLink<String>("personaldetails",
>> PersonalDetailsPage.class));
>> add(new BookmarkablePageLink<String>("personaldetails2",
>> PersonalDetailsPage.class));
>>
>> ....
>>
>> Click Here
>> Profile page
>>
>>
>>
>>
>>
>>
>>
>> jWeekend wrote:
>> >
>> > Jason,
>> >
>> > What are you trying to achieve?
>> >
>> > Here are some ideas that may give the desired effect, depending on what
>> > that is ...
>> >
>> > 1 - Make a model for your data and give that to all the Label instances
>> as
>> > required, (but each with their unique id and separate markup).
>> > 2 - Use a repeater (like a ListView) to render several labels (no
>> > repetition of Java code or markup).
>> > 3 - Write a method that takes a model (or just a String) and an id, that
>> > returns an appropriately configured Label instance  (saves on repeating
>> > Java code - still need markup per component and your own unique ids).
>> >
>> > Regards - Cemal
>> >  http://www.jWeekend.co.uk <http://www.jweekend.co.uk/> jWeekend
>> >
>> >
>> >
>> > novotny wrote:
>> >>
>> >>
>> >> I have a simple label "hello" and I want to display it twice in the same
>> >> page, but wicket complains the wicket:id needs to be unique in my
>> >> page.... what do I need to do, is there an alias or something?
>> >>
>> >> Thanks, Jason
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/how-to-reuse-a-label-in-the-same-page--tp20964351p20964551.html
>>  Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.4 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


Re: how to reuse a label in the same page?

Posted by Jeremy Thomerson <je...@wickettraining.com>.
I'm pretty sure that you can just add it once in Java and multiple times in
the HTML, although I've never pondered the (potential) side-effects of
this.  Give it a shot and let us know how it works for you.  With something
as stateless / simple as a BookmarkablePageLink, there probably couldn't be
much in the way of side-effects, although with very complex, stateful
components, I could see that maybe there would be an issue... (maybe??)
-- 
Jeremy Thomerson
http://www.wickettraining.com


On Thu, Dec 11, 2008 at 3:29 PM, novotny <no...@gridsphere.org> wrote:

>
>
> Basically I need two of the same links on the page, and it looks like I
> have
> to do this which just seems kinda lame...
>
> add(new BookmarkablePageLink<String>("personaldetails",
> PersonalDetailsPage.class));
> add(new BookmarkablePageLink<String>("personaldetails2",
> PersonalDetailsPage.class));
>
> ....
>
> Click Here
> Profile page
>
>
>
>
>
>
>
> jWeekend wrote:
> >
> > Jason,
> >
> > What are you trying to achieve?
> >
> > Here are some ideas that may give the desired effect, depending on what
> > that is ...
> >
> > 1 - Make a model for your data and give that to all the Label instances
> as
> > required, (but each with their unique id and separate markup).
> > 2 - Use a repeater (like a ListView) to render several labels (no
> > repetition of Java code or markup).
> > 3 - Write a method that takes a model (or just a String) and an id, that
> > returns an appropriately configured Label instance  (saves on repeating
> > Java code - still need markup per component and your own unique ids).
> >
> > Regards - Cemal
> >  http://www.jWeekend.co.uk <http://www.jweekend.co.uk/> jWeekend
> >
> >
> >
> > novotny wrote:
> >>
> >>
> >> I have a simple label "hello" and I want to display it twice in the same
> >> page, but wicket complains the wicket:id needs to be unique in my
> >> page.... what do I need to do, is there an alias or something?
> >>
> >> Thanks, Jason
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/how-to-reuse-a-label-in-the-same-page--tp20964351p20964551.html
>  Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: how to reuse a label in the same page?

Posted by novotny <no...@gridsphere.org>.

I meant

<!--
Click Here 
Profile page 
-->

at the bottom...


novotny wrote:
> 
> 
> Basically I need two of the same links on the page, and it looks like I
> have to do this which just seems kinda lame...
> 
> add(new BookmarkablePageLink<String>("personaldetails",
> PersonalDetailsPage.class));
> add(new BookmarkablePageLink<String>("personaldetails2",
> PersonalDetailsPage.class));
> 
> ....
> 
>  Click Here 
>  Profile page 
> 
> 
> 
> 
> 
> 
> 
> jWeekend wrote:
>> 
>> Jason,
>> 
>> What are you trying to achieve?
>> 
>> Here are some ideas that may give the desired effect, depending on what
>> that is ...
>> 
>> 1 - Make a model for your data and give that to all the Label instances
>> as required, (but each with their unique id and separate markup).
>> 2 - Use a repeater (like a ListView) to render several labels (no
>> repetition of Java code or markup).
>> 3 - Write a method that takes a model (or just a String) and an id, that
>> returns an appropriately configured Label instance  (saves on repeating
>> Java code - still need markup per component and your own unique ids).
>> 
>> Regards - Cemal
>>  http://www.jWeekend.co.uk jWeekend 
>> 
>> 
>> 
>> novotny wrote:
>>> 
>>> 
>>> I have a simple label "hello" and I want to display it twice in the same
>>> page, but wicket complains the wicket:id needs to be unique in my
>>> page.... what do I need to do, is there an alias or something?
>>> 
>>> Thanks, Jason
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/how-to-reuse-a-label-in-the-same-page--tp20964351p20964589.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: how to reuse a label in the same page?

Posted by novotny <no...@gridsphere.org>.

Basically I need two of the same links on the page, and it looks like I have
to do this which just seems kinda lame...

add(new BookmarkablePageLink<String>("personaldetails",
PersonalDetailsPage.class));
add(new BookmarkablePageLink<String>("personaldetails2",
PersonalDetailsPage.class));

....

Click Here 
Profile page 







jWeekend wrote:
> 
> Jason,
> 
> What are you trying to achieve?
> 
> Here are some ideas that may give the desired effect, depending on what
> that is ...
> 
> 1 - Make a model for your data and give that to all the Label instances as
> required, (but each with their unique id and separate markup).
> 2 - Use a repeater (like a ListView) to render several labels (no
> repetition of Java code or markup).
> 3 - Write a method that takes a model (or just a String) and an id, that
> returns an appropriately configured Label instance  (saves on repeating
> Java code - still need markup per component and your own unique ids).
> 
> Regards - Cemal
>  http://www.jWeekend.co.uk jWeekend 
> 
> 
> 
> novotny wrote:
>> 
>> 
>> I have a simple label "hello" and I want to display it twice in the same
>> page, but wicket complains the wicket:id needs to be unique in my
>> page.... what do I need to do, is there an alias or something?
>> 
>> Thanks, Jason
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/how-to-reuse-a-label-in-the-same-page--tp20964351p20964551.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: how to reuse a label in the same page?

Posted by jWeekend <jw...@cabouge.com>.
Jason,

What are you trying to achieve?

Here are some ideas that may give the desired effect, depending on what that
is ...

1 - Make a model for your data and give that to all the Label instances as
required, (but each with their unique id and separate markup).
2 - Use a repeater (like a ListView) to render several labels (no repetition
of Java code or markup).
3 - Write a method that takes a model (or just a String) and an id, that
returns an appropriately configured Label instance  (saves on repeating Java
code - still need markup per component and your own unique ids).

Regards - Cemal
http://www.jWeekend.co.uk jWeekend 



novotny wrote:
> 
> 
> I have a simple label "hello" and I want to display it twice in the same
> page, but wicket complains the wicket:id needs to be unique in my page....
> what do I need to do, is there an alias or something?
> 
> Thanks, Jason
> 

-- 
View this message in context: http://www.nabble.com/how-to-reuse-a-label-in-the-same-page--tp20964351p20964390.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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