Hi,
I am a newer, please bear my ignorance.
I have a PoJo java class, it have more than two propertys, so HashMap
is useless. The code is like this:
public class Property {
public String n;
public String k;
public String vCH;
public String vEN;
///pass over the geter & seter
}
I put the ArrayList<Property> in the VelocityContext.
ArrayList<Property> props = new ArrayList<Property>();
props.add();//add some object of Property
VelocityContext.put("prop", props);
The Template file is like that:
#foreach(${p} in ${prop})
${p}"
key="${p.k}"
label="${p.l}"
#end
The result is display:
[EMAIL PROTECTED]"
key="${p.k}"
label="${p.l}"
[EMAIL PROTECTED]"
key="${p.k}"
label="${p.l}"
It can get ${p}, but can't get the field of $p.
HashMap<String,String> is iterator ok, It's the Velocity can't
iterater ArrayList<PoJoObject>?
Appreciate with U answer.
Mead Lai
www.yayisoft.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]