You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by fabley <a....@lrworld.com> on 2012/09/19 15:31:33 UTC
Variable number of links with just one wicket id?
Hello,
I’m pretty new to Wicket and I want to realize the following thing:
There is a variable number of links which I’d like to show on my page with
only one wicket-id… So that there can be added links in the Java Code
without adding them in my HTML-file. Is there any solution to do this?
Kind regards
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Variable-number-of-links-with-just-one-wicket-id-tp4652150.html
Sent from the Users forum 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: Variable number of links with just one wicket id?
Posted by fabley <a....@lrworld.com>.
That worked for me, thank you so much!
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Variable-number-of-links-with-just-one-wicket-id-tp4652150p4652168.html
Sent from the Users forum 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: Variable number of links with just one wicket id?
Posted by fabley <a....@lrworld.com>.
Great, that finally worked for me, even if i didn't need the " " :-)
Thank you!
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Variable-number-of-links-with-just-one-wicket-id-tp4652150p4652209.html
Sent from the Users forum 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: Variable number of links with just one wicket id?
Posted by Martin Grigorov <mg...@apache.org>.
On Thu, Sep 20, 2012 at 5:50 PM, fabley <a....@lrworld.com> wrote:
> Hello again,
>
> I'm sorry but it seems like this doesn't work for me. In your example it
> always uses the same text for each link, but I want to define my own text
> for each link. Is there a way to do this?
>
> Code Snippets:
>
>> HTML
>>
>>
>> <div id="menu">
>>
>> <ul>
>> <li wicket:id="repeater">
You need <li wicket:id="repeater"><a wicket:id="link"></a></li>
>> </li>
>> </ul>
>>
>> </div>
>
>
>> Java
>>
>> RepeatingView view = new RepeatingView("repeater");
>> Link link = new Link("1") {
new Link("link)
>> @Override
>> public void onClick() {
>>
>> }
>> };
link.setBody(Model.of("Some text"));
>> view.add(link);
>> add(view);
>
>
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Variable-number-of-links-with-just-one-wicket-id-tp4652150p4652178.html
> Sent from the Users forum 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
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Variable number of links with just one wicket id?
Posted by Jeremy Thomerson <je...@wickettraining.com>.
On Thu, Sep 20, 2012 at 9:53 AM, Jeremy Thomerson <jeremy@wickettraining.com
> wrote:
> On Thu, Sep 20, 2012 at 9:50 AM, fabley <a....@lrworld.com> wrote:
>
>> Hello again,
>>
>> I'm sorry but it seems like this doesn't work for me. In your example it
>> always uses the same text for each link, but I want to define my own text
>> for each link. Is there a way to do this?
>>
>> Code Snippets:
>>
>> > HTML
>> >
>> >
>> > <div id="menu">
>> >
>> > <ul>
>> > <li wicket:id="repeater">
>> > </li>
>> > </ul>
>> >
>> > </div>
>>
>>
>> > Java
>> >
>> > RepeatingView view = new RepeatingView("repeater");
>> > Link link = new Link("1") {
>> > @Override
>> > public void onClick() {
>> >
>> > }
>> > };
>> > view.add(link);
>> > add(view);
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://apache-wicket.1842946.n4.nabble.com/Variable-number-of-links-with-just-one-wicket-id-tp4652150p4652178.html
>> Sent from the Users forum 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
>>
>>
> Add a label to each link. Then in your code set the model for the label
> according to what is being linked to.
>
Or, in your link override onComponentTagBody and write the text out. But a
label is generally better.
--
Jeremy Thomerson
http://wickettraining.com
*Need a CMS for Wicket? Use Brix! http://brixcms.org*
Re: Variable number of links with just one wicket id?
Posted by Jeremy Thomerson <je...@wickettraining.com>.
On Thu, Sep 20, 2012 at 9:50 AM, fabley <a....@lrworld.com> wrote:
> Hello again,
>
> I'm sorry but it seems like this doesn't work for me. In your example it
> always uses the same text for each link, but I want to define my own text
> for each link. Is there a way to do this?
>
> Code Snippets:
>
> > HTML
> >
> >
> > <div id="menu">
> >
> > <ul>
> > <li wicket:id="repeater">
> > </li>
> > </ul>
> >
> > </div>
>
>
> > Java
> >
> > RepeatingView view = new RepeatingView("repeater");
> > Link link = new Link("1") {
> > @Override
> > public void onClick() {
> >
> > }
> > };
> > view.add(link);
> > add(view);
>
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Variable-number-of-links-with-just-one-wicket-id-tp4652150p4652178.html
> Sent from the Users forum 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
>
>
Add a label to each link. Then in your code set the model for the label
according to what is being linked to.
--
Jeremy Thomerson
http://wickettraining.com
*Need a CMS for Wicket? Use Brix! http://brixcms.org*
Re: Variable number of links with just one wicket id?
Posted by fabley <a....@lrworld.com>.
Hello again,
I'm sorry but it seems like this doesn't work for me. In your example it
always uses the same text for each link, but I want to define my own text
for each link. Is there a way to do this?
Code Snippets:
> HTML
>
>
> <div id="menu">
>
> <ul>
> <li wicket:id="repeater">
> </li>
> </ul>
>
> </div>
> Java
>
> RepeatingView view = new RepeatingView("repeater");
> Link link = new Link("1") {
> @Override
> public void onClick() {
>
> }
> };
> view.add(link);
> add(view);
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Variable-number-of-links-with-just-one-wicket-id-tp4652150p4652178.html
Sent from the Users forum 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: Variable number of links with just one wicket id?
Posted by Martin Grigorov <mg...@apache.org>.
Hi,
See AbstractRepeater and its specializations (e.g. RepeatingView, ListView).
http://www.wicket-library.com/wicket-examples-6.0.x/repeater/wicket/bookmarkable/org.apache.wicket.examples.repeater.RepeatingPage
On Wed, Sep 19, 2012 at 4:31 PM, fabley <a....@lrworld.com> wrote:
> Hello,
>
> I’m pretty new to Wicket and I want to realize the following thing:
>
> There is a variable number of links which I’d like to show on my page with
> only one wicket-id… So that there can be added links in the Java Code
> without adding them in my HTML-file. Is there any solution to do this?
>
> Kind regards
>
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Variable-number-of-links-with-just-one-wicket-id-tp4652150.html
> Sent from the Users forum 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
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org