[thelist] need help loading default image, then changing it with actual image

Chris Johnston fuzzylizard at gmail.com
Tue Nov 15 20:01:13 CST 2005


I have an odd problem that I need the lists help with.

First, the specifics: JSP/Servlet app

I am writing a document versioning application. One of the pages includes
file information. On this page, I have an icon that changes depending on the
file type (file extension). Currently, the way that this is implemented is
that the jsp scriptlet gets the extension of the file and concatenates this
wil .png and retrieves the appropriate icon. So if the file extension is
.doc, it would look up the image doc.png.

However, I can not have icons for every kind of file extension. What I would
like to do is if the icon does not exist, the page should load up a default
image. I accomplished this using css by setting a background image, but not
all the images are the same size, so it overlays the front image with the
background image. (this looks funny depending on the images)

I would like to figure out a way of doing this with either JSP and/or css
instead of JavaScript. However, I am open to all suggestions.

www.fuzzylizard.com <http://www.fuzzylizard.com>

More information about the thelist mailing list