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 Does File Exist Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Does File Exist" Watch "Does File Exist" New topic
Author

Does File Exist

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1390
How can I check to see if a network file exists using JSP code from the client side. If I run on my local web host server the File class works to find a file using the unc path but when I deploy it to the production web server the file cannot be found.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39537
    
  27
Where does this "network file" exist - on the client where the browser runs, on the server where the web app runs, or on some other machine?


Ping & DNS - updated with new look and Ping home screen widget
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1390
It is located on a network machine different from the Web Server.

I think I might have found another solution at least partly. Instead of the File class I am using the URL Class except I cannot figure out how to tell if the URL does not return as valid. How can i test the URL to know wheather or not to process other code on my JSP?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39537
    
  27
Using the File class should work, unless that machine has a different type of file system, e.g. SMB - is that the case?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60046
    
  65

Originally posted by Steve Dyke:
... using JSP code from the client side.


Clarification: JSP code runs on the server, not the client.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Does File Exist
 
Similar Threads
connect with CGI
access ctrl exception in J2EE
Signle sign on without using Session Cookie
Upload file at shared location
response.sendRedirect problem