That should have been:
template:
<span wicket:id="text">default value</span>
Result:
<span class="red_border">default value</span>
Erik.
Erik van Oosten wrote:
>
> Ah! Well, that's easy. Don't add a label, but a AtributeBehavior (or one
> of its subclasses):
>
> template:
> default value
>
> Java:
> add(new WebMarkupContainer("text").add(new AttributeAppender("class", new
> Model("red_border"), " ")));
>
> Result:
> default value
>
> I have no knowledge of a way to access the text that is in the template.
>
> Regards,
> Erik.
>
>
>
> severian wrote:
>>
>> Thanks for that Erik, I may well have to go with that if there are no
>> other suggestions. But I'm still keen to learn if I can keep the Label
>> text once I add a "wicket:id" attribute to the label markup.
>>
>> I may, for example, have to change (later in development) the
>> label-marking mechanism. So, instead of adding a "*" character, I may
>> have to colour the label red, or add a border, or whatever. So I was
>> looking for a way to centralise the label-marking mechanism in java, with
>> no impact on the markup, to make such a change as easy as possible.
>>
>> I figured the best way to do this was just to make the whole label a
>> wicket component, so that I could manipulate it however I liked in java.
>> But doing that seems to lose the label text altogether...
>>
>
>
--
View this message in context:
http://www.nabble.com/Accessing-Template-Value-of-a-Label-tf3796116.html#a10738030
Sent from the Wicket - User mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user