just curious...where would a servlet default to opening a file without an
absolute path....ie
BufferedReader in = new BufferedReader(new FileReader(blah.db));
StreamTokenizer inStream = new StreamTokenizer(in);
I am having trouble with those lines of code. It is throwing
exceptions...Any ideas...
-g-
At 02:26 PM 4/25/99 -0700, you wrote:
>> However, I am not sure
>>if servlets can open up text files on the local server, and if this is
>>feasible.
>
>Sure it's possible and feasible. We just finished a prototype as a prelude
>to using a relational database. We used a simple random access file, opened
>in the init method, saved in a global variable, accessed in the doPost
>method (see below). Simple, even primitive, but it works. Our biggest
>problem was figuring out what directory on our hosted site our servlet was
>expecting to find the file.
>
>Regards,
>Steve Mann
>
># # #
>
>// in init
>
> gDataFile = new RandomAccessFile ( gDataFileName, "r" );
>
>// In doPost
>
> gDataFile.seek ( 0 );
> long filePtr = 0;
> while ( filePtr < gDataFile.length ()) {
> line = gDataFile.readLine ();
> // do something.....
> filePtr = gDataFile.getFilePointer ();
> }
>
>-------------------------------------------
>Creative Digital Publishing Inc.
>1317 Palm Street, San Luis Obispo, CA 93401-3117
>-------------------------------------------
>805.788.0138 805.593.3811 (fax)
>[EMAIL PROTECTED] http://www.cdpubs.com
>
>___________________________________________________________________________
>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
>
>
--
[ G. Naik http://www.message-server.com ]
[ Carroll-Net Inc. "NJ's Premier Internet Service Provider" ]
___________________________________________________________________________
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