Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

creating a tree in JSP  RSS feed

 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check Jenkov JSP Tree Tag and JSP Tree Tag.
 
Vijaishanker bala
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3640
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They must be having provision for it. Just check the documentation.
 
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!