Using ${} or %{} is a proper way to inject values into a message
https://struts.apache.org/getting-started/message-resource-files.html#message-resource-property-files

In your case a "getPlaceholder()" will be used to fetch the value from
the current action.


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

pt., 1 lut 2019 o 16:25 Micael Carreira <mcarre...@itclinical.com> napisał(a):
>
> Hey,
>
> In my action I'm using getText(myKey) to get a localized string. This
> string has some placeholders of mine, in ${placeholder} format. Consider
> my original key is defined as this in my properties file:
>
>      myKey = Some text ${placeholder} more text.
>
> I've read in Struts documentation that it uses MessageFormat. So, if I
> want literals, I need to use single quotes. This is what I did in my
> properties file:
>
>      myKey = Some text '${placeholder}' more text.
>
> However, when I call getText(myKey) I get: Some text ' more text. Why
> does this happen?
>
> I also noticed that the problem is the dollar sign AND curly brackets
> without any character in between. If I have this definition:
>
>      myKey = Some text '$' text '{placeholder}' more text.
>
> It gets resolved to: Some text $ text {placeholder} more text.
>
> Can somebody explain me how can I escape the dollar and curly brackets
> characters?
>
> Thanks in advance, have a nice weekend.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to