java - BigDecimal evaluated as a string in Velocity, Struts2 -


I am using struts2 with Velocity 1.5 and Velocity Tool 1.3. In my template I want to do a loop:

  #set ($ count = $ {item.qty}) #foreach ($ i in [1 .. $ count]) $ {Item.price} ........... #end  

$ {item.qty} is a BigDec, but it seems that it's the speed of the velocity May be passed as. Since this loop does not work, works fine instead of $ count = 5, and printing $ {item.qty} gives me 5 results. Velocity 1.5 and Tool 1.3 will support the highest version Struts 2. idea? Solution? Thank you

I think you need to put it in the integer of your loop to make it work the wanted.

  #set ($ count = $ item.getQty (). IntValue ())  

Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -