aspose file tools*
The moose likes JSP and the fly likes about file separator Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "about file separator" Watch "about file separator" New topic
Author

about file separator

Wang Fong
Greenhorn

Joined: Feb 01, 2005
Posts: 6
hi,please help.

<%@page contentType="text/html" import="java.io.*,java.util.*" buffer="64kb"%>
<%
String file1=request.getParameter("p1");

try
{
BufferedReader in=new BufferedReader(new FileReader(file1));
Vector filename=new Vector();
.
.
%>

will show exception, if I change it to:

BufferedReader in=new BufferedReader(new FileReader("c:\\aaa.csv"));

it will be ok.

actually,file1="c:\aaa.csv",JSP need "c:\\aaa.csv", how to convert to it?

thanks,
Wang
Dan Vos
Greenhorn

Joined: Dec 18, 2004
Posts: 3
What do you really want to do with your logic?
Is that a client submits a file link to JSP file, then app server tries to read it??? and you want to pass in a local address???
Wang Fong
Greenhorn

Joined: Feb 01, 2005
Posts: 6
yes,it read a CLIENT file,the file locates at c:\aaa.csv.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61769
    
  67

Cannot be done that way. The server has no direct access to files on the client machine.

Search for information on file uploading and multi-part forms.
[ February 01, 2005: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Originally posted by Bear Bibeault:
Search for information on file uploading and multi-part forms.


Dan,

Go ahead with apache commons fileupload

cheers.
Wang Fong
Greenhorn

Joined: Feb 01, 2005
Posts: 6
thanks,my logic was wrong. after I upload the file to server,then it fixed.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: about file separator