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 Selecting the directory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Selecting the directory" Watch "Selecting the directory" New topic
Author

Selecting the directory

Abhi kedia
Greenhorn

Joined: Sep 05, 2002
Posts: 5
Is there any way to Browe in the network and select a directory? How?
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

with named machines, you can access the shared file system on a emote machine via its name.
eg give a machine with the name 'dave', and a shared directory called 'share' with a file called 'file.txt', you can put file://dave/share/file.txt
Is this what you were looking for?
Abhi kedia
Greenhorn

Joined: Sep 05, 2002
Posts: 5
No I don't want to select a file? I want to know how to implement the functionality for the selection of a Directory in the network by Browsing and selecting the directory in jsp
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

So I got off track, but can't you just remove the file?
file://dave/share/
...
Shubhrajit Chatterjee
Ranch Hand

Joined: Aug 23, 2001
Posts: 356
Could you sate your requirement in detail ???
If it is a NT system, you can browse the file system with the File API
If it is a UNIX flavour and the remote file system is mounted, then you can browse it too using the file APIs.(Never tried it, but common sense says that it would work)
Could not offer any better suggestion. Your question was not clear


Shubhrajit
Abhi kedia
Greenhorn

Joined: Sep 05, 2002
Posts: 5
Requirement is that I have to select the directory from the client side and save that in the db for further transaction from the directory. Thus file cannot be selected. The form should provide the button to choose the path and select the directory.
by putting the input type in the htmlform we can do that for files. I want to know that any such method is there for selecting the directory.
Shubhrajit Chatterjee
Ranch Hand

Joined: Aug 23, 2001
Posts: 356
Why dont you write a JSP which loads initially, shows the root folder and all lists all subfolders as links. Clicking on any subfolder, will show its sub-folders .. and so on.
If the user reaches the correct folder he can submit using a button, and then you can do your required procesing.
Java File APIs can be used to do all sorts of folder manipulations. File APIs don't only deal with files .. they deal with folders too !!! Just check out the API documentation of java.io.File and you will find what you are looking for
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Selecting the directory