You don't need a label for this.  Instead, do this (leave your HTML the
same):

WebMarkupContainer mydiv = new WebMarkupContainer("MyDiv");
mydiv.add(new AttributeModifier("class", true, "the-class-name"));
add(mydiv);

On Thu, Jul 29, 2010 at 6:07 PM, jverstry <jvers...@gmail.com> wrote:

>
> Hi,
>
> In the body of an HTML, I have something like this:
>
> <div wicket:id="MyDiv" class="ValueToModify">
>    Embedded content to be added
> </div>
>
> I have created a label to be able to modify the content of 'class' as
> following:
>
> public class MyDivLabel extends Label {
>    ...
>    @Override
>    protected void onComponentTag(ComponentTag tag) {
>        super.onComponentTag(tag);
>        tag.put("class", "The class value I want to set");
>    }
>    ...
> }
>
> In the web page, I add the labels as following:
>
> ...
> add(new MyDivLabel("MyDiv","xxx"));
> add(new Label("MyEmbedded","My embedded text"));
> ...
>
> a) Is it ok to embed Labels like I do?
> b) How can I make sure the embedded span will not be replaced by "xxx"?
>
> Thanks !!!
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Question-about-embedded-labels-tp2307332p2307332.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


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

Reply via email to