velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tomek Maćkowski <tmackow...@gmail.com>
Subject Re: Escapng problem
Date Wed, 07 Dec 2005 09:07:55 GMT
Yes,

#set( $d = '$' )
arg1value="${d}{var:maxlength}"

works ok.
Thanks



apache@recks.org napisał(a):

>The formal reference notation ${foo} is hopefully a good
>workaround to make it work:
>
>#set( $d = '$' )
>arg1value="${d}{var:maxlength}"
>
>It seems to me you found two related bugs in the parser.
>a) Trying to parse something that is not a real reference (starting
>   with "${" and contining a ":") and throwing a PEE.
>b) Interpreting a "{" in the middle of a reference as part of it.
>
>Could you/someone confirm these are really bugs - testing against
>other similar expressions, creating a test-case, and then add a
>JIRA issue.
>
>Cheers,
>Christoph
>
>Tomek Ma&#263;kowski wrote:
>  
>
>>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&#322;(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&#263;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
>>>>        
>>>>
>
>---------------------------------------------------------------------
>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


Mime
View raw message