velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Huffstedtler" <rhuffstedt...@ironworks.com>
Subject creating references to arbitrary hashtable
Date Mon, 27 Oct 2008 15:27:26 GMT
Hi folks -

 

I am helping a group migrate some content from Coldfusion to Velocity.
In their CF code, they have a custom tag which they use in individual
pages for grouping commonly used page variables into a pseudo-object
before passing it off to the page wrapper.  The model is very similar to
the use of the VelocityLayoutServlet, so that's the direction I'm going
for the migration.

 

However, trying to set properties on a VTL identifier does not seem to
work if the identifier does not reference an object.  The documentation
does not make it clear that that is a requirement
(http://velocity.apache.org/engine/releases/velocity-1.5/user-guide.html
#references).  The description of properties implies that one can
associate a VTL identifier with a hashtable, but there aren't clear
directions for doing so.

 

Putting this -

 

#set ( $slots.foo = "Foo")

 

In my index.vm and referencing it like this in my Default.vm:

 

$slots.foo<br/>

 

Is just resulting in $slots.foo being output as a literal.

 

Can someone point me in the right direction here?

 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message