[prev in list] [next in list] [prev in thread] [next in thread] 

List:       velocity-user
Subject:    Re: Velocity and Javascript
From:       "Nick Bauman" <nick () cortexity ! com>
Date:       2001-10-18 19:33:14
[Download RAW message or body]

You should carefully read:

http://jakarta.apache.org/velocity/user-guide.html#String%20Literals

and

http://jakarta.apache.org/velocity/user-guide.html#Parse

> Just thought I'd close out this issue, given the many helpful comments
> I received.
> 
> It was, what we call an 'operator headspace problem.'  Basically, I was
> using a template to pull some javascript code from the context and
> embed it in the page (which worked just fine).  But I tried to get too
> clever, because I had a  Velocity varb (the '$key') included in the
> Javascript. Don't know where my brain was, but I guess I was thinking
> that Velocity can recursively render a template (or something like
> that). Obviously, it can't. Once I put the Javascript where it really
> belongs (in the template), everything worked fine.
> 
> Regards,
> 
> Terry
> 
>> ----- Original Message -----
>> From: "Terry Steichen" <terry@net-frame.com>
>> To: <velocity-user@jakarta.apache.org>
>> Sent: Wednesday, October 17, 2001 9:53 AM
>> Subject: Velocity and Javascript
>>
>>
>> Hope this isn't a silly question, but can Velocity dynamically
>> generate individual lines of Javascript code?
>>
>> I know it can spit out an entire Javascript section (<script
>> language=javascript> javascript_stuff </script>, where the parts are
>> constructed ahead of time in Java and then 'put' into the context.
>>
>> But, what I'd like to do is, inside the javascript block, initialize a
> varb
>> as thus:
>>
>>     var sesskey = "$key";
>>
>> where $key is a Velocity variable.
>>
>> But it doesn't seem to work.
>>
>> I'm probably missing something very obvious and simple, but any help
>> would be humbly appreciated.
>>
>>
>> Regards,
>>
>> Terry


-- 
Those willing to give up a little freedom for a little bread are likely to 
lose both. --Sidney Crooke, American Abolitionist

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic