0

I have one Wicket text property in the WicketApplicationProperties.properies

 <entry key="dataMniejszaNizMinimalna">Wybrano datę, która jest mniejsza niż minimalna akceptowalna data '${minimalnaData}'. Nie można zapisać danych."</entry>

How to substitute a parameter {minimalnaData} with a use of a class StringResourceModel. I don't want to create any models i want to just display a message with provided one attribute. The Wicket StringResourceModel is so complicated.

new StringResourceModel(resourceKey).setParameters(params)

how to provide this one parameter is a simplest way.

PrzemyslawP
  • 190
  • 1
  • 13

2 Answers2

2

The simplest way could be:

new StringResourceModel(resourceKey, this, Model.ofMap(Map.of("minimalnaData", "some value")))

The model object could be a Java Bean or a java.util.Map.

StringResourceModel also supports java.text.MessageFormat. You can use its #setParameters() method to pass an array of values for the placeholders.

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

I think wicket:message should fit your need. Take a look at the wiki:

https://cwiki.apache.org/confluence/display/WICKET/Wicket%27s+XHTML+tags

You can nest components within textual content.

Andrea Del Bene
  • 2,521
  • 1
  • 15
  • 20