Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to retrieve the directory structure on the server and display it in an Applet

 
Bala Subramanian
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to retrieve the directory structure on the server and display it to the user. Once the user selects a folder from the tree, the files have to load on a different pane. Of course the folder structure could change on the server if any folder or file is added. In short, i have to get something like the windows file explorer. Is it possible to do this with applet alone or use servlets. If we can do this using servlets, how can i retrieve the folder structure and send it to the applet which will be the user interface?

Is there any other way to achieve this?
[ December 18, 2004: Message edited by: Bala Bala ]
 
Joe Ess
Bartender
Posts: 9339
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Bala Bala. Please change your displayed name to meet the
JavaRanch Naming Policy. User names cannot be obviously fake and must constist of a first name and a last name. You can change it here
Now, as for your question, there's a chapter in the Java Tutorial on How to use Trees. Basically what you need to do is make a data model which reads the file system. I suggest you attempt to do this locally before you attempt to do it on the network. Once you get it working, you can tackle breaking the model and the GUI apart and putting a network layer between.
You have a couple of options for a network layer. You could write your own custom server, but that would be tedious and error prone. If you have to put your app on the internet, servlets would be your best solution. Servlets are very flexible. You can stream XML or even serialized java objects get information to/from your gui. If you are working on an intranet and don't have firewalls to deal with, RMI (Remote Method Invocation) can simplify the network interface to a couple method calls.
 
Bala Subramanian
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thx for the info. I came to know that trees can be easily created using ".js" files. So, i thought i would fetch the directories on the server with the help of a servlet. I was successful in fetching the directories and files but with this, how do i create the tree structure. Can somebody tell me how to form the tree logically - how to maintain the parent and child relationship between the folders- so that i can write it into a script file. I use a recursive method to retrieve the files.

Thanks
Bala
 
Joe Ess
Bartender
Posts: 9339
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JavaScript (.js) and Java are different languages. Applets are written in Java and this is the forum for applet questions. If you have a question about JavaScript, you should post in the HTML and JavaScript forum.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic