You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@jakarta.apache.org by "Craig R. McClanahan" <Cr...@eng.sun.com> on 2000/03/31 19:29:15 UTC

Re: dynamic data

The servlet spec provides two approaches to doing this.  If you only need
read-only access, the best approach is probably to use
ServletContext.getResource() and/or ServletContext.getResourceAsStream() to
read files from the document root of your web-app.  For example, this is what
the JSP page compiler can use to read the source code of your JSP page.

Alternatively, you can call ServletContext.getRealPath() to get the absolute
pathname of your resource file, and then use normal Java file i/o.

Craig McClanahan


gfe@ooglee.com wrote:

> Hi,
>
> We are writing an application that uses the file system for a variety
> of dynamic data and state. Can anyone suggest a model for including
> this sort of data under the tomcat/webapps/<appname> path, or is
> there a different model?
>
> -- Fred Ellis
>    Aliaron, Inc.
>
>   ------------------------------------------------------------------------
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: general-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: general-help@jakarta.apache.org