hi,
Thanks for your teaching.
The data in the POJO, is a group data, have some mapping. I think need
use some HashMap
to replace it.

BestRegards,
Mead


On Fri, May 2, 2008 at 12:41 AM, Nathan Bubna <[EMAIL PROTECTED]> wrote:
> Velocity doesn't provide access to fields (even public ones) by default.
>  you can't skip having getters and setters here.  you need to have
>
>  public String getN() { return n; }
>  public String getK() { return k; }
>  and so on...
>
>  in order to do $p.k or $p.n
>
>
>
>  On Wed, Apr 30, 2008 at 11:51 PM, Mead Lai <[EMAIL PROTECTED]> wrote:
>
>  > 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]
>  >
>  >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to