You can implement the ServletContextAware interface in your action, and Struts will set the ServletContext which has a "getPath" method, or something like that.
musachy On Fri, Feb 6, 2009 at 9:03 AM, 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 > > -- "Hey you! Would you help me to carry the stone?" Pink Floyd --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org