File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Soft Skills this week in the Jobs Discussion 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: 12835
    
    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