Hi, hope anybody can help me with this problem I'm having.
I've created a java bean called Category which looks something list this
public class Category
{
private int id;
private String name;
private Vector children; // a vector of Category objects
public Category(){};
public void setId(int id)
{
this.id = id;
}
public int getId()
{
return id;
}
// rest of get and set methods
}
I've store the data inside a database table like the below
category id name description parent id
1 category 1 This is a base folder -1
2 category 2 This is also a base folder -1
3 sub category 1 This is a sub folder 2
4 sub category 2 ... 2
5 sub sub category .... 4
I need to load this data back out of the database into a category array (Category[] cat) so I loop through the array and display all category (and child categorys) on a page.
Will I need recursive methods to retreive the data and display it on the screen? I'm trying to write one but I keep getting into an infinite loop!!!!
Can anybody help me out?