> There is absolutely no guarantee that webapp resources even *have* a "file
> path" at all -- it's perfectly legal for the container to run your
> application directly from a WAR file (Tomcat has an option for that), or
> dump your static resources into a database, or anywhere else it wants.
> 
> To read a resource file like this, use the following:
> 
>   InputStream is =
>     getServletContext().getResourceAsStream("/file.dat");
Yep, was actually cruising the sourcecode and just got this a few
minutes ago.  The servlet context has all the nice methods for file
access ;)

> where the path you pass starts with a slash, and is relative to the
> context root.  This is how Struts reads your struts-config.xml file, by
> the way, using a typical path like "/WEB-INF/struts-config.xml".
> 
> As a side note, placing your data file directly in the context root
> directory like this makes it possible for clients to access the file
> directly.  If you don't want this (in other words, if the file is only for
> internal use by your app), you can put it in /WEB-INF instead.
Naturally. I was actually writing a custom taglib to check for the
existence of an asset (graphic file, which is a headshot of a
member) and to use it as a logic:present like tag.  I am actually
going to start a new thread with the sourcecode for that.

Dan

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Daniel Allen, <[EMAIL PROTECTED]>
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
There is no such thing as a casual knowledge of xslt, either 
you know everything about it or you are sitting in the creek.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to