Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Selecting the directory

 
Abhi kedia
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any way to Browe in the network and select a directory? How?
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I got off track, but can't you just remove the file?
file://dave/share/
...
 
Shubhrajit Chatterjee
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Abhi kedia
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 356
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic