velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Bubna <nbu...@gmail.com>
Subject Re: Escapng problem
Date Tue, 06 Dec 2005 14:40:45 GMT
#set( $d = '$' )
arg1value="$d{var:maxlength}"

or if you have the EscapeTool in the context (from VelocityTools)

arg1value="$esc.d{var:maxlength}"

\$foo is for escaping _references_ not for escaping the $ character. 
velocity was still trying to parse it as a reference.

On 12/5/05, Tomek Maćkowski <tmackowski@gmail.com> wrote:
> Hi
>
> I have a problem with escaping '$' character in Velocity
>
> I want to produce literal:
> arg1value="${var:maxlength}"
>
> When i type it in my template "as is" I recive an exception:
>
>      [java] org.apache.velocity.exception.ParseErrorException:
> Encountered ":maxlength}\"\r\n" at line 25, column 49.
>      [java] Was expecting one of:
>      [java] "}" ...
>      [java] <DOT> ...
>
>
> When I type
>
> arg1value="\${var:maxlength}"
>
> result is the same.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
Mime
View raw message