Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring 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:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Using JFileChooser in a webapplication

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I need to use JFileChooser in my web-application, any help will be deeply
appropriated.
 
Marshal
Posts: 69782
277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You didn’t say what you know about file choosers already, so I shall give you a Java tutorials link.
 
sadanand munswamy
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Campbell Ritchie,
I have been doing java for a long time, So i do know it.
Some how i need to invoke a file chooser from my web-application that should allow
the user to choose only directory and no files.
 
Sheriff
Posts: 21972
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can only use a JFileChooser in combination with an applet. Because of the applet's security restrictions, it needs to be signed first.

The important question is, however, why you need to let users select a directory. Using a JFileChooser would let the user choose a local directory where the server has no access to (other than through the applet, but only while the applet is active). Is that what you want? Or do you want the user to select a directory on the server? In that case, perhaps you can build some HTML based file browser yourself (or find some existing code to do that). Make sure that the user cannot select just any directory; keep the selection as limited as possible.
 
sadanand munswamy
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Rob,
Thanks for your valuable insights, And you are absolutely correct, as i need to choose any directory
from the server and not the local. Is there any read to use html file chooser, which can do the trick for me.
Thanks Again.
 
Rob Spoor
Sheriff
Posts: 21972
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out http://stackoverflow.com/questions/9068156/server-side-file-browsing. You may need to tweak it a bit to get it to show only directories.
 
Ever since I found this suit I've felt strange new needs. And a tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic