velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Byron Foster <>
Subject Re: Velocity Variables are accepted in JavaScript Array??
Date Fri, 12 Jun 2009 01:43:23 GMT
Looking at the generated javascript should reveal all. If in Velocity  
you say

#set($foo = "bar")

will render as:


When the javascript runs the second line is referencing a variable  
'bar' which is not defined, and will cause a javascript error.

If you have the error console running in your browser, you should see  
javascript errors to this effect.

On Jun 11, 2009, at 6:24 , Int64 wrote:

> Your suggestion for suggestions.push("$show"); really worked,
> But can you please explain why suggestions.push($show);was not  
> working and
> it was not working with my values from database(it was working for
> hard-coded values). and why your suggestion worked??
> bluejoe-2 wrote:
>> if $show is a string, you can try
>> suggestions.push("$show");
>> VTL renders on server-side
>> while javascript executes on browser
>> yours,
>> bluejoe

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message