On 7/12/07, Josh Vickery <[EMAIL PROTECTED]> wrote:
Actually, I think this is a bug in the handling of MessageResources in
Struts 2.  Not only do ' characters in properties files fail to
display, they cause parameter substitution to fail.  For example, if
you have a properties file:

I don't use Struts2 - but my guess is that this is down to a single
quote being an escape character in MessageFormat:

http://java.sun.com/j2se/1.4.2/docs/api/java/text/MessageFormat.html

So its probably not a bug - just need to escape single quotes (with a
single quote) in any messages.

Struts1 message resources automatically escaped quotes (which
sometimes caused problems in itself - and theres now an option to turn
if off)

Niall

foo=Message's for {0}

and you attempt to display it in a jsp like so:

<s:text name="foo"><param name="value" value="${user.firstname}"></s:text>

the displayed text is

Messages for {0}

if you double the ' (foo=Messages''s for {0}) you get:

Messages for Josh

On 7/12/07, Antonio Petrelli <[EMAIL PROTECTED]> wrote:
> 2007/7/12, TonyD <[EMAIL PROTECTED]>:
> >
> >
> > Thanks it works!
>
> Mmm... this means that there's something wrong when you display the text.
> I think that, before writing the string, you have to escape it.
> How, and where, do you write the string?
>
> Antonio

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to