velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "White, Tim" <Tim.Wh...@qwest.com>
Subject RE: interpolation of variables ...
Date Tue, 13 Jan 2004 17:43:20 GMT
Wouldn't it be easier to build these up in a Hashtable, and just put the hashtable into the
context at the end?

My $.02,

Tim

> -----Original Message-----
> From: Chris Joelly [mailto:chris.joelly@unycom.com] 
> Sent: Tuesday, January 13, 2004 10:34 AM
> To: velocity-user@jakarta.apache.org
> Subject: interpolation of variables ...
> 
> 
> Hello!
> 
> i'm new to velocity and run into the following problem:
> 
> i set some data into the context from within my action class:
> 
> context.put("field-23", "data23");
> context.put("field-24", "data24");
> ....
> 
> then in the velocity template i wanna do something like:
> 
> #foreach ( $df in $datafields )
> 	#set ( $fieldname = "field-$df.getFieldId()" )
> 	#set ( $fieldvalue = "${$fieldname}" )
> 	<input type="text" name="$feldname" value="$fieldvalue"/>	
> #foreach
> 
> i wanna set a variable name dynamically and then lookup the 
> context for the value of this variable...
> 
> is this possible with velocity? if so, can anybody tell me how to do?
> 
> thx, Chris
> 
> -- 
> mit freundlichen Grüßen / with kind regards
>  
> Ing. Christian Jölly @ Solutions
> unycom  Information Technology Services GmbH
> A-8042 Graz | Schmiedlstraße 1 / III
> 
> Tel: ++43 (0)316 / 818 828 - 30
> Fax: ++43 (0)316 / 818 828 - 38
> chris.joelly@unycom.com
> http://www.unycom.com
> 
> Polizist: "In ihrem Zustand heißt die Devise: Hände weg vom 
> Steuer!" Betrunkner Autofahrer: "Was, wenn ich blau bin soll 
> ich auch noch freihändig fahren?" 
> 
> ---------------------------------------------------------------------
> 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