velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rupali Gupta" <r.gup...@mpstechnologies.com>
Subject RE: simple problem
Date Mon, 20 Jul 2009 07:30:43 GMT
Hi,

 

Use $velocityCount in place where you need incremental value of some
variable

Eg: instead of,

 

 #set($a = 0)

#foreach($mapping in $mappings)

Do something..

#set($a = $a+1)

 

<label for="journal-$a">Type something</label>

 

Do it like:

 

#foreach($mapping in $mappings)

Do something..

<label for="journal- $velocityCount ">Type something </label>

 

 

$velocityCount increase the value of variable incrementally, without having
to use ($a= $a+1)

 

I hope this helps!

 

Thanks,

Rupali

 

 

  _____  

From: lanxiazhi [mailto:lanxiazhi@gmail.com] 
Sent: Monday, July 20, 2009 12:52 PM
To: Velocity Users List
Subject: Re: simple problem

 

we know this #set($a = $a + 1) will change $a which in some cases may not be
preferable...but thanks anyway.

2009/7/20 Alexander <the.malkolm@gmail.com>

Hi,

 

Use 

 

#set($a = $a + 1) 

 

Correct me if Im wrong but if u use variable like this it would write
"hello" on a single line, where is the problem? 

 

#set($newline="hello")

$newline 

 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message