Title: Re: [Wicket-user] Setting link text

Thanks for the replies, guys!

Just wanted to follow up on this to share how I ended up doing things.

BTW: I was very new to Wicket at the time I asked the question. Now I have been digging into it a bit more.

My concern was that adding a <span> inside every <a> when I wanted to dynamically set the link text/label was unneccesary markup clutter for the browser to handle. I /do/ think it makes sense to add a Label component to a Link component in the Wicket component tree.

After looking at Wicket for a few more days I found that I could call setRenderBodyOnly( true ) on the Label, and the <span> would go away, leaving a tidier page for the browser.

I also only just recently found setStripWicketTags() to clean up the output a bit more, and now I am very happy with what the browser gets.

Thank you for the time and effort you put into developing Wicket and helping your users on this list!

Karl-Erik




On 01-03-06 23:35, "Johan Compagner" <[EMAIL PROTECTED]> wrote:

Thats why we need a LabelLink where the model is the text.
We can't do that we oure current Link objects, because it could be used by something else


johan


On 3/1/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
but where do we specify the text? i, and im sure others, use the model for other things.
Label(String, IModel, IModel) ? kinda nasty if you ask me

-Igor



On 3/1/06, Johan Compagner <[EMAIL PROTECTED]> wrote:
yeah.. i still like to have such a link inside the core (called LabelLink or something)
I still think that most beginnners always look at this and ask "Why do i need to add an extra label"
The link text, if it is pushed by the javacode" is in my eyes many times just something of that link.

johan



On 3/1/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
link is a generic link container that can wrap anything. so no, there is no direct way to do it unless you are using ExternalLink.

you would have to do:
Link link=new Link("link")....
link.add(new Label("lbl"......

and in your markup
<a href="" wicket:id="link"><span wicket:id="lbl">my link</span></a>

if you want you are free to create a simple subclass of link that does this for you using replaceComponentTagBody(), see Label for details.

-Igor



On 3/1/06, Riyad Kalla <[EMAIL PROTECTED]> wrote:
I think you can add a Label to the link and it will render... but I'm
not a wicket guru, just an interested 3rd party :)

Karl-Erik Rønsen wrote:
> I am creating tabs that should get their titles generated by code. What's
> the best way to set the link text?
>
> I am new to Wicket, but so far i really enjoy the way that Java and HTML
> work together with this framework.
>
> Thanks,
> Karl-Erik
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting language
> that extends applications into web and mobile media. Attend the live webcast
> and join the prime developer group breaking into this new coding territory!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642  <http://sel.as-us.falkag.net/sel?cmd=lnk&amp;kid=110944&amp;bid=241720&amp;dat=121642>
> _______________________________________________
> Wicket-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 <http://sel.as-us.falkag.net/sel?cmd=lnk&amp;kid=110944&amp;bid=241720&amp;dat=121642>
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user  <https://lists.sourceforge.net/lists/listinfo/wicket-user>






Reply via email to