use links within dynamic messages

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

use links within dynamic messages

ravaszroka
Hello,
it is a bit long but i hope my problem/question is understandable

#1 The following works fine:

in HTML
  <wicket:message key="text">
     <a wicket:id="mylink">
         <wicket:message key="linktext" />
     </a>
  </wicket:message>


having in my prop file

text=part 1 ${mylink} part 2
linktext = link

i get what I expect: part 1 link part 2

#2 This works also fine
in HTML
<span wicket:id = "label" />

in JAVA
Label myLable = new Label("label", new StringResourceModel("text.${var}", model);
in my properties I have
text.E=text E
text.R=text R

if my model has a method getVar() that returns "E" or "R" I get what I expect.

#3 what I need is to combine #1 and #2, i.e. the text around my label should change depending on my model. However Label is not a MarkupContainer so I can't add the Link to it. Is there a component that behaves like a label but is also a Container?

in HTML (?)
<span wicket:id="text">
     <a wicket:id="mylink">
         <wicket:message key="linktext" />
     </a>
</span>

in my properties I'd have
text.E = part1 E ${mylink} part2 E
text.R = part1 R ${mylink} part2 R
linktext=link

Which wicket component could I use for "text"

Thanks!