java - How to access the values of arraylist using variable in vm file? -
i m using code access values in arraylist:
#foreach($bean in $requestlist) #set($i = $velocitycount) #set($rowformatcomponents = $uirowformatlist[$i] )
im getting parser exception saying
org.apache.velocity.exception.parseerrorexception: encountered "[" expecting 1 of: <rparen> ... <whitespace> ... "-" ... "+" ... "*" ... "/" ... "%" ... <logical_and> ... <logical_or> ... <logical_lt> ... <logical_le> ... <logical_gt> ... <logical_ge> ... <logical_equals> ... <logical_not_equals> ... <dot> ...
help in finding solution.
the indexed access lists new in velocity 1.7. based on stacktrace, think you're using older version. depending on how older is, can either:
- access using
list
methods, example#set($rowformatcomponents = $uirowformatlist.get($i) )
- use the list tool, if have enabled or if can enable it
- if have control on gets in context, use real
list
instead of array, in case can use list methods
Comments
Post a Comment