velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Husted <hus...@apache.org>
Subject Indirect references
Date Fri, 08 Aug 2003 18:11:00 GMT
This may sound odd, but, if it were possible, I'd like to do a bit of 
indirection in my variable references.

The use case is this: I have a list in the context. The list may end up 
under one name or another, but I do know what the list's name is before 
I forward to the template. I'd like the template to set a local variable 
to the list based on the name that I pass inside of another variable.

Essentially, something like this:

#set($list = ${$listname})

where I've already something like has already been done (in one place or 
another):

.set("someName",list);

... later ...

.set("listname","someName");

and have $list be a pointer to list in the first statement.

Possible?

-Ted.


-- 
Ted Husted,
   Junit in Action  - <http://www.manning.com/massol/>,
   Struts in Action - <http://husted.com/struts/book.html>,
   JSP Site Design  - <http://www.amazon.com/exec/obidos/ISBN=1861005512>.




Mime
View raw message