X

Geertjan's Blog

  • March 27, 2006

Generating Wicket Labels: How Far Can One Go? (Part 1)

Geertjan Wielenga
Product Manager
I'm making finetuned little steps forward with the Wicket support module I've been working on. Now, when you drag the Label item into the HTML page, you get this dialog box:

When you select the "Markup label" checkbox, you get this in the HTML page (as before):

<span wicket:id="message1">this text will be replaced</span>

However, you get something different in the Java file:

Label markupLabel = new Label("message1","<b>Hello World!</b>");
markupLabel.setShouldEscapeModelStrings(false);
add(markupLabel);

When you deploy the above web page, you get "Hello World!" in bold. In other words, you get some sample code that, basically, illustrates how HTML markup is done in Wicket. Personally, I think that's quite useful (until I came across the snippet above today, I didn't know how to do this).

In addition to the above, I've now also set things up so that the Wicket ID in the "Label Customizer" increments automatically, so that, if you take the default values more than once, you end up with a unique Wicket ID each time.

I'd like to add more refinements such as the above to the "Label Customizer". Is there anyone out there who could offer some ideas in this area?

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.