Thanks Joe, ya I want more info. I think we will choose the narrower and deeper family. Let me know if you have anymore ideas.
>From: Joe Cheng <[EMAIL PROTECTED]> >Reply-To: A mailing list about Java Server Pages specification and >reference <[EMAIL PROTECTED]> >To: [EMAIL PROTECTED] >Subject: Re: Please help! Recursive loop in JSP >Date: Mon, 12 Nov 2001 17:21:24 -0500 > >I had to do this once... fun problem. > >First of all, forget about doing it "in JSP"... you should use Java classes >for this. > >Two ways to do it, IMO. If you have a large and flat dataset, i.e. many >records in the table but no trees that go more than a few generations deep, >you can have a method in the Person object of signature: > public Person[] getAllChildren() >that queries for all the children, and calls getAllChildren() on them, and >adds the results into some kind of vector. However, that will result in >many calls to the database because each getAllChildren() call will cost you >a query. > >If the dataset is narrower and deeper, i.e. a few very deep families, you >can create a method that loads up all the data in one query and then >constructs the objects using a method similar to the above. The advantage >of this is that you only have to run the query once; the disadvantages are >that you have loaded all this data that may or may not be used. > >Let me know if you need more detail... > >-jmc > >-----Original Message----- >From: Frank Mancini [mailto:[EMAIL PROTECTED]] >Sent: Monday, November 12, 2001 5:04 PM >To: [EMAIL PROTECTED] >Subject: Please help! Recursive loop in JSP > > >I have a recursive looping problem here. > >For example, say I have this table > >id, name, parent > >1,john,4 >2,bill,3 >3,cathy,4 >4,jackie,0 >5,jeff,4 >6,joe,7 >7,amy,0 > >Essentially, > >jackie doesn't have a parent, but has john, jeff and cathy as children. >bill >is the child of cathy and thus jackies grandchild. > > >How would I do this query such that I say I want to see all the children >(including everyone below him/her) below, say jackie...this is really a >self >join to oneself with an unknown number of levels below. > >How would I do this in jsp do display all of jackies relatives below her? > >_________________________________________________________________ >Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp > >=========================================================================== >To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff >JSP-INTEREST". >For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST >DIGEST". >Some relevant FAQs on JSP/Servlets can be found at: > > http://archives.java.sun.com/jsp-interest.html > http://java.sun.com/products/jsp/faq.html > http://www.esperanto.org.nz/jsp/jspfaq.jsp > http://www.jguru.com/faq/index.jsp > http://www.jspinsider.com > >=========================================================================== >To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff >JSP-INTEREST". >For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST >DIGEST". >Some relevant FAQs on JSP/Servlets can be found at: > > http://archives.java.sun.com/jsp-interest.html > http://java.sun.com/products/jsp/faq.html > http://www.esperanto.org.nz/jsp/jspfaq.jsp > http://www.jguru.com/faq/index.jsp > http://www.jspinsider.com _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com