[prev in list] [next in list] [prev in thread] [next in thread] 

List:       velocity-user
Subject:    Re: how do i deal with these?
From:       lordi <lord.of.board () gmx ! de>
Date:       2002-07-24 9:16:07
[Download RAW message or body]

In my opinion the easiest way would be to create a class,
which holds one database row like:

class person{
	int id;
	string name;
	...

	public string getName(){return name;}
	public int getId(){return id;}
	...
}

After that you add these to a vector and last but not least
add this vector to the context.

best regards,
lordi

>I've got the following results from my database query program,
>
>userid ,username
>_____________
>1,"james"
>2,"michael"
>...
>...
>and i want to build the Velocity variables to hold the results
>how do i construct it in my java program? like that?
>
>Vector v1 = new Vector();
>v1.addElement(1);
>v1.addElement(2);
>...
>
>Vector v2 = new Vector();
>v2.addElement("james");
>v2.addElement("michael");
>...
>
>context.put("v1",v1);
>context.put("v2",v2);
>
>
>
>or construct two arraies?
>_______________
>
>array1 = {1,2,...};
>array2={"james","michael",...};
>




--
To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic