• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to select and open a file using jsp?

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I need the code to select a file from the specified directory by browsing for that file(html file) and to open it on the internet explorer.
Or I want to know how I can achieve this using some of the api or javascript in jsp?
Thanks in advance
Seeema
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The thread below has the code to select the directory using JFileChooser: http://www.javaranch.com/ubb/Forum33/HTML/001305.html
Once you have the file you can either "execute" the file and let the MIME type direct what browser gets opened:
Process p = Runtime.getRuntime().exec(f); //opens with whatever application the user has specified for that extension type
or you can NAME the browser and hope that the user has the application and that it is in the path:
String runThis = "\"" + "ie.exe " + f + "\""; //create the command in quotes
Runtime.getRuntime().exec(runThis);
[This message has been edited by Cindy Glass (edited April 23, 2001).]
 
Seema Shetty
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Cindy,
I tried to execute the code which is here.But it gives me application error when it tries to open the file.Why is that so?
Thanks
Seema
 
Cindy Glass
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which code did you try? and can you show us your version of it?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic