Using a FileInputStream like that won't work if the war is packaged.
Take a look at the getResourceAsStream method in the ServletContext
interface instead.

Nils-H

On Fri, Feb 6, 2009 at 3:03 PM, Security Management
<list-subscripti...@secmgmt.com> wrote:
> I have an action that returns an image, and the getImageStream method
> returns the stream associated with the blob in the database that I'm
> pulling.
>
> That works great, and displays/exports the image exactly like I want to.
>
> However, there are cases where there is no image, and I want to display a
> "No Image Found" image.
>
> So, the getImageStream is:
>
> public InputStream getImageStream()
>        {
>            if(this.imageStream != null)
>            {
>                return this.imageStream;
>            }
>            else
>            {
>                return new FileInputStream("no_image.jpg");
>            }
>        }
>
> My questions is how do I get the path to no_image.jpg?  Here is its location
> in the war file.  It is not on the classpath.
>
> -rw-r--r--      4827  29-Oct-2008  19:47:26  images/no_image.jpg
>
> Thanks,
> Mike.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to