On Thu, 7 Mar 2002, wilbert moore wrote:

> What I'm trying to do is probably pretty simple.  Its pretty easy to
> do in VB/ASP so I know this will be a breeze for someone to answer.
>
> My servlet is to read in an html file's contents which is sitting in
> a folder under the main server's root.  Since I have not yet been
> successful in configuring tomcat to work under apache's control, my
> servlet is at http://localhost:8080/servletname
>
> If my html file is at http://localhost:80/page.html, what is the
> call I need to make to find the raw directory
> (eg. c:\odd_directory\web\templates\ )
>
> I could obviously code this in hard, which I did to test so far,
> however, if the app were moved, this would not work.
>
> Thanks for the help, and I hope I supplied enough info for this
> simple task.

You might want to look at the ServletContext methods getRealPath,
getResource, and getResourceAsStream, and some related ones.

Also, since you're new to servlets, it might be a good idea to browse
through the servlet API to get an idea what's available.  It's all
available online at:

http://java.sun.com/products/servlet/2.3/javadoc/index.html

And of course, a good servlets book is helpful as well (e.g. Jason
Hunter's or Marty Hall's).

Milt Epstein
Research Programmer
Software/Systems Development Group
Computing and Communications Services Office (CCSO)
University of Illinois at Urbana-Champaign (UIUC)
[EMAIL PROTECTED]

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to