It would be easy to store them in a subdirectory of the web app, which would allow me to include them in my JSPs with a simple HREF tag. However, does this cause problems with the size of the web app, maybe the start-up and reload speeds of the container, etc.? I trialed this by storing 1500 images in myWebApp/Pictures, starting Tomcat and retrieving images with a HREF tag in a JSP. I didn't notice any impact on startup time or performance, but I want to make sure I'm not missing some other problem...
I would definitely advise against storing them in your webapp; my experience is that you sometimes want to be able to completely delete your webapp and replace it with a "fresh" build, which you can't do if you are writing data into the directory.
If I store them in the filesystem outside of the web app directory structure, I can't just refer to them in my JSPs with an HREF tag, right? It would be more work to have an action servlet retrieve the image file and return it to the browser in the response object.
In our deployment environment, we have a web server receive all HTTP requests, and the webserver proxies application requests to a J2EE server. This allows the web server to deal with all the more routine requests like delivering images, stylesheets, and javascript. The app would write uploaded images to a directory which is visible to the webserver, so that the app wouldn't be involved in servicing requests for images. (I think this is more or less what Colin described.)
Most importantly, I'd advise writing an "image manager" class which encapsulates all this logic, so that most of your application is insulated from any changes you might have later. This image manager class could be configured with a "filesystem path", a "web url prefix" and other such data, and then your actions can simply give it uploaded images as bytes or streams and "trust" that they'll be handled correctly, and then ask it to give them the right path for retrieving the image via URL, whether that is a path which is ultimately served by a web server going to the filesystem or whether it's a path to a servlet or Struts action which copies the bytes (from a DB BLOB column, a non-web accessible filesystem path, or wherever). If you have metadata like Colin described, then this class would probably also have the responsibility for long-term persistence of the metadata.
Joe
--
Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "Narrow minds are weapons made for mass destruction" -The Ex
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]