When I try to put some dynamic parts in my texts to be used by <s:text>
tag in Struts 2, these parts are replaced by the params
that I defined.
Here is how I write my sentences in my file.properties
:
my_error=The event {0} doesn't exist
Here is how I try to display it:
<s:text name="my_error">
<s:param>Event01</s:param>
</s:text>
But in the result, the expression {0}
is not replaced and I have no error in the log. What's wrong?
I really can't understand. I picked this example, so I have this in my jsp file:
<s:text name="msg.error">
<s:param >Event01</s:param>
</s:text>
<br />
<s:text name="name.msg.param" >
<s:param >mkyong</s:param>
</s:text>
and this in my .properties:
msg.error = This event doesn't exist: {0}
name.msg.param = This is a message from properties file - param : {0}
But the result is:
This event does not exist: {0}
This is a message from properties file - param : mkyong
I do not manage to find a real difference.