1

I have hard-coded the link destination URL in the below link.

<a href="+https://accent.com+" target="_parent"></a>


I need to re-factor the code so that the URL is set dynamically (reading it from a property file) Any one has an idea how to achieve that in wicket?
Thank you.

2 Answers2

3

You can use org.apache.wicket.markup.html.link.ExternalLink in your Java code. Its model can read/load it from anywhere you need.

martin-g
  • 17,243
  • 2
  • 23
  • 35
1

This is possible without the need for any Java code.

Given a properties file with a key for the url and the links label:

url = http://www.stackoverflow.com
label = Help me!

One can simple use Wicket message system:

<a wicket:message="href:url"><wicket:message key="label" /></a>

Tested with Wicket 6.19.0
In the Wicket guide: Reading bundles with tag <wicket:message>

Imperative
  • 3,138
  • 2
  • 25
  • 40