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. 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?
Never ascribe to malice that which can be adequately explained by stupidity.
Joined: Oct 25, 2004
Jesper, Shobhana, thanks for your informative replies - it's all working now!
Jeff - whereas this solution is obviously clear to one as Sun-certified as yourself, sometimes they are less so to those of us with less experience. Half a reply isn't much use when you're on a deadline.
Joined: Sep 16, 2005
I was trying to follow the Java Ranch credo of "Give a man a fish... Teach a man to fish..."
Half a reply isn't much use when you're on a deadline.
Following Dave's advice would have been a * of alot faster than waiting for a reply. Get familiar with the basic Java library if you are using java.io classes it should be obvious that they use the java.io.File class to represent the disk file. Bill