Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

about file separator

 
Wang Fong
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes,it read a CLIENT file,the file locates at c:\aaa.csv.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65111
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks,my logic was wrong. after I upload the file to server,then it fixed.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic