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:

  1. access using list methods, example #set($rowformatcomponents = $uirowformatlist.get($i) )
  2. use the list tool, if have enabled or if can enable it
  3. if have control on gets in context, use real list instead of array, in case can use list methods

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -