1. If the file is on the same machine as the server, you can just refer to
the file with an absolute pathname. In the project I work on, we have placed
absolute pathnames into the servlets.properties file, like this
fileName=/users/aTemplateFile
Then in the servlet init routine we do this
template=getInitParameter("fileName");
which gets the filename from the properties file. After that we can open and
read the file with the File class. It works with no problems.
If however, the file is on another machine, then the above won't work.
Kevin Mukhar
> ----------
> From: ANUPAMA PONNAPALLI[SMTP:[EMAIL PROTECTED]]
> Reply To: A mailing list for discussion about Sun Microsystem's Java
> Servlet API Technology.
> Sent: Thursday, February 25, 1999 4:50 AM
> To: [EMAIL PROTECTED]
> Subject: Problems : file not found with servlets, redirect to frame,
> banded printing
>
> 1. My servlet tries to read a file and write it to the output stream. I
> have
> tried using methods like getCodebase but the servlet looks for the
> servlets directory.. i have tried to configure the same but with little
> use.
> When i tried to give the relative address of the file name and then used
> the toURL method, i again got the file not found exception.
>
>
___________________________________________________________________________
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