I needed a tree control for my app also, and thought that I was stuck with
an applet.  I ended up writing two classes following the same lines as
swing's JTree control.  I have a TreeNode which holds any information each
individual node must contain, and I have a Tree class which holds all the
node objects.  My tree class is used to build(graphically) my database, so
that users can traverse the database, and view objects, their content, etc.
Each of my nodes knows what level its at(root nodes are at level 0, their
children are at 1, etc).  I have folder and document icons for the nodes and
I've wrapped these in href tags that call the JSP page that the tree is
displayed in(the tree is a session scoped bean) and pass as a parameter the
object ID of the node that was clicked.  I get the node from the tree(given
the object ID passed to the page) and ask the node if it is expanded or
collapsed.  If its collapsed, I query the database for its children, and
redraw the tree.  If its expanded, I remove the child nodes from the node,
and redraw the tree.

I really like the way it turned out.  If you didn't know better you'd think
it was an applet.  Its really quick, and its all server-side.  I like the
fact that the user doesn't have to download this big applet, and that they
don't have to install the java plugin(if you want to use swing's JTree your
users will have to have the java plugin because browsers don't support
JDK1.2 yet).

-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Luis Perez
Sent: Monday, March 27, 2000 9:08 AM
To: [EMAIL PROTECTED]
Subject: Tree


Hi all,

I'm in the process of creating an application using JSP. My application
has a menu on the header and a subset of options for each one of the
menu options. For the subset of options I have on mind to use applets
because
I want to display a nice looking tree. Is it recommendable to use applets?,
is there another way to create selection trees?...

Luis

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to