velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Leidigh <jleid...@uol.com.ar>
Subject String to Int for array index
Date Thu, 12 Dec 2002 16:48:11 GMT
I have a var I pass in a hidden field from one vm to the next.  The var, 
which is a number is being intepreted by velocity as a string but I want 
to use it to index a local array?  Ex:

page1.vm

<html>... yada yada
#set ($arr = ["One", "Two"])
#set ($x = 1)
$arr.get($x) #* Works and prints "One" *#
<input type="hidden" name="val" value="$x">
</html>

page2.vm

<html>
#set ($arr = ["One", "Two"])
$myBean.val  #*  Prints "1" *#

$arr.get( $myBean.val ) #* FAILS, Prints: "$arr.get( $myBean.val )" *#

I know the simple answer is  make sure the  bean/servlet does the 
conversion internally but I am dealing with a closed solution which 
passes me form vars from one page to the next and I have no control 
until I get to the next vm.  I think maybe a tool is my only way to 
go......can anyone help?

Thanks
Jason Leidigh



--
To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>


Mime
View raw message