You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Tomek Maćkowski <tm...@gmail.com> on 2005/12/06 08:00:51 UTC
Escapng problem
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
Re: Escapng problem
Posted by Tomek Maćkowski <tm...@gmail.com>.
Thanks for response
I tried :
#set( $d = '$' )
arg1value="$d{var:maxlength}"
but result is still
[java] org.apache.velocity.exception.ParseErrorException:
Encountered ":maxlength}\"\r\n" at line 25, column 49.
[java] Was expecting one of:
[java] "}" ...
[java] <DOT> ...
Nathan Bubna napisał(a):
>#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 <tm...@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
>>
>>
>>
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: Escapng problem
Posted by Nathan Bubna <nb...@gmail.com>.
#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 <tm...@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
>
>