You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jim Steinberger <st...@dynedge.com> on 2006/10/11 05:07:59 UTC
Escaping quotes in OGNL expressions in Tapestry templates
Hello,
I ran into the situation where I needed to insert a double-quote in an OGNL expression. I wanted to do: value="ognl:'Section: \"' + section.name + '\"'", but the Tapestry parser doesn't like that very much.
A solution offered in the archives is to explicitly declare the component in the .page or .jwc file, where you can escape strings in the parameter-bindings just like in Java.
I prefer anonymous components directly in the template, myself, and wanted to offer the alternative of using Java's Unicode capability: "ognl:'Section: \u0022' + section.name + '\u0022'". Double Quote = \u0022, Single Quote = \u0027. Works great for me in Tapestry 4.0.2.
Jim
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Escaping quotes in OGNL expressions in Tapestry templates
Posted by Ron Piterman <rp...@gmx.net>.
have you tried:
value="ognl:'Section: "' + section.name + '"'"
?
Cheers, Ron
Jim Steinberger wrote:
> Hello,
>
> I ran into the situation where I needed to insert a double-quote in an OGNL expression. I wanted to do: value="ognl:'Section: \"' + section.name + '\"'", but the Tapestry parser doesn't like that very much.
>
> A solution offered in the archives is to explicitly declare the component in the .page or .jwc file, where you can escape strings in the parameter-bindings just like in Java.
>
>
> I prefer anonymous components directly in the template, myself, and wanted to offer the alternative of using Java's Unicode capability: "ognl:'Section: \u0022' + section.name + '\u0022'". Double Quote = \u0022, Single Quote = \u0027. Works great for me in Tapestry 4.0.2.
>
>
> Jim
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org