Board index » jbuilder » Images and servlets

Images and servlets

2004-05-19 02:33:20 AM
I'm trying to get my servlet and jsps to include some image files. I've
tried dozens of places to deposit them but no matter where I try, when I
run the servlet the images can not be found.
Fortunately deployment to an actual production server went smoothly, but
now I'm doing another web project and would love to have this mystery
Anyone have a reference I can read on the subject or a hint?

Re:Images and servlets

Anyone have a reference I can read on the subject or a hint?
Are you deploying this in an EAR, WAR, or blown up? If you're doing this
blown up (as in a development environment), you may have some problems when
you goto deploy it as a WAR or EAR. You might want to take a look at
creating a resource jar file and then using the
getClass.getResourceAsStream() and make sure the resource.jar file is on/in
the classpath.
There is also putting them into the WEB-INF directory structure, but that is
a bit harder to faithfully reproduce in a deployment environment for
development, testing, QA, and release modes.
But then again, the other gurus here may have some better ideas. I tried
this for my swing test apps and it works well when everything is all jar'd