I need assistance in creating a stream tokenizer on a client file. How do I set up an inputstream to the file and only to the file. If I use the following code I get more than the file to tokenize.
- Posted by: John Merikle
- Posted on: March 14 2001 14:02 EST
BufferedReader br = new BufferedReader(new InputStreamReader(request.getInputStream()));
StreamTokenizer in = new StreamTokenizer(br);
this sets up an input stream but I don't now how to specify the file that is entered on the HTML page.
I am new to servlets so all help would be greatly appreciated
John, if I understand your question, the answer is that you can't access the clients file system using either JSP's or servlets. They execute on the server, not the client. If you go back through the earlier threads for this discussion board, you should find a similar question asked and answered. There may find some other solution you can use.
Not sure if I've got this right, but it looks like you want to retrieve a file that has been submitted to a servlet through an HTML form (input type=file). Is that what you meant?
If so, go over to http://www.servlets.com. You will need the com.oreilly.servlets package (to make things easier). They have several excellent examples of servlets parsing multi-part form data from a client-submitted form. Once you've checked the documentation, I bet it won't take you an hour or two to put it all together.