You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Eric Rank <er...@lo-fi.net> on 2007/02/27 23:32:58 UTC
[S2] Single quote in package.properties
This should be an easy one.
When putting a single quote in a package.properties resource bundle
entry, by default, the quote get's removed and none of the variables
in the entry get loaded.
1. What's the best way to have an entry with a single quote?
Using ' with <s:property value="%{message}" escape="false" />
works, but is this the only way?
2. What are the rules behind how the single quotes work in the
package.properties files? Said differently, what's the intended and
expected behavior of a string with a single quote?
=================================
For example, in the package.properties file:
message.myMessage=I've added a single quote in the first word. and
this variable {0} will not get populated
renders as:
"Ive added a single quote in the first word. and this variable {0}
will not get populated"
when I expect:
I've added a single quote in the first word. and this variable
VariableSentIn will not get populated
=================================
Thanks!
Eric Rank
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] Single quote in package.properties
Posted by Eric Rank <er...@lo-fi.net>.
Thanks Alexander,
I still think I'm missing something though. From the Javadoc:
http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html
<snip>
Escapes are not necessary for single and double quotes; however, by
the rule above, single and double quote characters preceded by a
backslash still yield single and double quote characters, respectively.
</snip>
This would suggest that a single quote would be fine and appear as
expected. However, since single quotes disappear, this suggests to me
that struts2 is doing something a little more. Any ideas?
Thanks,
Eric
On Feb 27, 2007, at 3:42 PM, abpicol@br.ibm.com wrote:
> It really is, Eric.
>
> package.properties is nothing more than a standard
> java.util.Properties
> file. See the javadoc for this class and you get this question
> answered,
> and will see many more "interesting" things ;-)
>
> Alexander
>
>
>
>
>
> Eric Rank <er...@lo-fi.net>
> 27/02/2007 19:32
> Please respond to
> "Struts Users Mailing List" <us...@struts.apache.org>
>
>
> To
> Struts Users Mailing List <us...@struts.apache.org>
> cc
>
> Subject
> [S2] Single quote in package.properties
>
>
>
>
>
>
> This should be an easy one.
>
> When putting a single quote in a package.properties resource bundle
> entry, by default, the quote get's removed and none of the variables
> in the entry get loaded.
>
> 1. What's the best way to have an entry with a single quote?
> Using ' with <s:property value="%{message}" escape="false" />
> works, but is this the only way?
>
> 2. What are the rules behind how the single quotes work in the
> package.properties files? Said differently, what's the intended and
> expected behavior of a string with a single quote?
>
> =================================
>
> For example, in the package.properties file:
>
> message.myMessage=I've added a single quote in the first word. and
> this variable {0} will not get populated
>
> renders as:
>
> "Ive added a single quote in the first word. and this variable {0}
> will not get populated"
>
> when I expect:
>
> I've added a single quote in the first word. and this variable
> VariableSentIn will not get populated
>
> =================================
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] Single quote in package.properties
Posted by ab...@br.ibm.com.
It really is, Eric.
package.properties is nothing more than a standard java.util.Properties
file. See the javadoc for this class and you get this question answered,
and will see many more "interesting" things ;-)
Alexander
Eric Rank <er...@lo-fi.net>
27/02/2007 19:32
Please respond to
"Struts Users Mailing List" <us...@struts.apache.org>
To
Struts Users Mailing List <us...@struts.apache.org>
cc
Subject
[S2] Single quote in package.properties
This should be an easy one.
When putting a single quote in a package.properties resource bundle
entry, by default, the quote get's removed and none of the variables
in the entry get loaded.
1. What's the best way to have an entry with a single quote?
Using ' with <s:property value="%{message}" escape="false" />
works, but is this the only way?
2. What are the rules behind how the single quotes work in the
package.properties files? Said differently, what's the intended and
expected behavior of a string with a single quote?
=================================
For example, in the package.properties file:
message.myMessage=I've added a single quote in the first word. and
this variable {0} will not get populated
renders as:
"Ive added a single quote in the first word. and this variable {0}
will not get populated"
when I expect:
I've added a single quote in the first word. and this variable
VariableSentIn will not get populated
=================================
Thanks!
Eric Rank
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org