Problem with variable inside gsp
        Posted  
        
            by xain
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by xain
        
        
        
        Published on 2010-04-26T02:38:34Z
        Indexed on 
            2010/04/26
            2:43 UTC
        
        
        Read the original article
        Hit count: 270
        
Hi, I have a loop inside a gsp page, and I want to do a calculation on the fly, so I set a variable:
<g:set var="total" value="0" />
And in the loop:
<g:each in="${mob}" var="m">
  ...
   <g:set var="total" value="${total+(m.q*m.sts.uf)}"/>
  ...
</g:each>
The "total" value does not correspond to the expected calculation. m.q is an integer, and m.sts.uf is a float.
Any hints ?
Thanks.
© Stack Overflow or respective owner