ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niels Beekman" <n.beek...@wis.nl>
Subject RE: about the iterate usage
Date Wed, 08 Feb 2006 22:58:00 GMT
Hi,

I'm not sure I understand your question, but the <iterate>-tag supports (amongst others)
all Collection implementations (so ArrayList is supported) and arrays. You do not have to
change anything in your first query to make it work. The []-syntax is there to let iBATIS
know it should retrieve property values from the current item of the loop.

Hope this helps,

Niels

________________________________________
From: stevenlou@gmail.com [mailto:stevenlou@gmail.com] 
Sent: woensdag 8 februari 2006 17:25
To: user-java@ibatis.apache.org
Subject: about the iterate usage

Dear all,
 
I know "iterate" is of java.util.List, so I  have to initial the length for the array in
Java. Generally it use brackets[].
  <iterate property="fruits" conjunction=",">
    (#fruits[].id#, #fruits[].name#)
  </iterate>
 
Now I need insert some data, and the length is not fixed. So can I use the arraylist to replace
list? Writing like this:
  <iterate property="fruits" conjunction=",">
    (#fruits.getid()#, #fruits.getname()#)
  </iterate>
 
Thanks so much for your warm-hearted help.
 
Steven

Mime
View raw message