This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSP and the fly likes creating a tree in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "creating a tree in JSP" Watch "creating a tree in JSP" New topic
Author

creating a tree in JSP

Vijaishanker bala
Ranch Hand

Joined: Sep 08, 2005
Posts: 82
Hi,
I am a newbie in JSPs and would like to have some help with the following problem, I would like to create a tree structure in JSP, say for example depicting the directory structure in windows. The directory structure looks like this

Root
My Computer
C:
test.txt
data.dat
D:
test1.txt
faq.txt
ANOTHER_DIR
xxx1.text
YYY1.dat
My Documents
My Pictures

Under this structure each file if it is a directory,has more files. What would be the best manner in which to achieve this. Would it be to parse the directory structure using J2SE, write it to a XML document and to process this document using JSP or is there any other easier way.

Thanks

Vijai


When you say "I wrote a program that crashed Windows," people just stare at you blankly and say "Hey, I got those with the system, for free." <br />Linus Torvalds
Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3636
Check Jenkov JSP Tree Tag and JSP Tree Tag.


My blood is tested +ve for Java.
Vijaishanker bala
Ranch Hand

Joined: Sep 08, 2005
Posts: 82
thanks, but I would also like to know how to get the whole directory hierarchy across to the JSP, for example,

Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3636
They must be having provision for it. Just check the documentation.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12755
    
    5
A couple of years ago I wrote a bean to facilitate presenting a file system tree in JSP and allowing the user to browse it and forward a selected directory/file to a servlet. Here is the bean code:

In the JSP you have to provide for setting the parameters that control which roots of the file system are browsable - the JSP I used looks like:


Note that the bean does all the HTML formatting and that CSS controls the appearance of directories and files.

Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: creating a tree in JSP
 
Similar Threads
how to capture the action while clicking on the tree structure. (tomahawk tree component)
empty document
Jsp
Develop UI displaying Tree Using XML
Drawing Tree