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

Directory Chooser on JSF

 
Mc. Alvin Bautista
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Is there anyone here who knows how to create a Directory Chooser in JSF or on jsp page?
It is a dialog box where you can select a directory and it will display
on the textfield the selected path.

Example path - > c:\Program Files\Adobe

I searched the internet but I haven't found anything about this Directory Chooser on JSF. There is a JDialogChooser but I think it is not applicable for my application because it is just for Java Application and not for Web Application. Is anyone here who knows how to implement this thing on web? Thanks.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18277
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First off, realize the difference between a client and a server. Although URLs may look similar to file paths, they're not. Having http access to a web server doesn't give you access to the filesystem on that machine. That requires a file server.

On the client side, web browsers are restricted in their abilities to access local resources. That's the only reason that the web is even as safe as it is. Under a normal setup, the only way you're going to get a file browser from a webapp is if the web page contains a file up/download component. In that case, you will be presented a file chooser popup that allows you to specify where the file that you're up- or downloading to the server is located on your local machine.

You have no option as to where (or if) an uploaded file will go if you send it to a web server. The server application controls that. If a server application wants to take your file named c:\My Documents\alldata.txt and store only the odd-numbered lines as elements in a database, an webapp can be written to do just that. Likewise, a web server can generate data on the fly that would download to your computer. I often create downloadable PDFs that way.
 
Mc. Alvin Bautista
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Tim, so it means, it is impossible to create the Directory Chooser on the web. Therefore, there is no other option but to type the folder path in the textfield. Am i right? Because the user can't open the Directory Chooser Dialog Box. They have to type the whole folder path.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic