-
test whether a file exists
Hello all,
I'm developing an application designed to return records along with any associated images. The images will be named after the records primary key; ie "102.jpg". I'm going to display the full record information on one jsp and provide a link to another jsp to display the image, via a button/link whatever.
The problem is that not all records have associated images and I have to engineer the system such that the link appears ONLY when an image is present in the img directory. How can I test at runtime whether file 102.jpg is present?
Thanks!
-
File file = new File("images/102.jpg");
if (file.exists())
//file exists
Similar Threads
-
By John Knoop in forum .NET
Replies: 8
Last Post: 02-28-2010, 01:57 PM
-
By Glen Kunene in forum Java
Replies: 1
Last Post: 04-01-2002, 04:41 PM
-
Replies: 2
Last Post: 01-03-2001, 10:40 AM
-
Replies: 0
Last Post: 11-08-2000, 12:57 PM
-
Replies: 3
Last Post: 05-31-2000, 10:30 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks