public void scfile() throws IOException{

HttpServletResponse response = ServletActionContext.getResponse();
response.setCharacterEncoding("UTF-8");

//上传文件路径
String fileName = request.getParameter("fielname");
System.out.println("filename=="+fileName);//ceshi.html


InputStream is = null;
FileOutputStream fs = null; DateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
try {
//is = cform.getImportfile().getInputStream();

//创建文件
File inFile = new File(fileName);

is=new FileInputStream(inFile);
                       

System.out.println("====");
BufferedReader br=new BufferedReader(new InputStreamReader(is));上面代码有什么问题,哪里错了
红色那行报文件路径[ERROR] ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'fielname' on 'class com.asideal.struts.hyym.action.HyymAction: Error setting expression 'fielname' with value '[Ljava.lang.String;@ae0ba7'
filename==ceshi.html
java.io.FileNotFoundException: ceshi.html (系统找不到指定的文件。)

解决方案 »

  1.   

    if(fileName!=null&&!fileName.trim().equals("")){
    inFile = new File(fileName);
    }
      

  2.   

    String fileName = request.getParameter("fielname");这个不对吧 你form提交是文件啊,file.getFileName好像是这个,还有服务端不能获得客户端本地文件路径 否则会很危险
      

  3.   

    是上传本地文件的,//上传文件路径
    String fileName = request.getParameter("fielname");这个是文件路径还是文件名字???
      

  4.   


    你这样的实现方式就不对。哪有这样获取文件名的?
    在不同os,不同浏览器,表单中,上传框的文本内容,通过request.getParameter("");获取的内容都不尽一样,有的是带路径的,有的却不是。所以,只能是,通过上传组件(你所使用的上传第三方jar),获取上传对象,从中获取文件名,size,类型等等信息。
      

  5.   

    老大应该是这样声明:
    FileInputStream fin = null;
    FileOutputStream fout = null;
    .....

    fout = new FileOutputStream(new File(filename));
      

  6.   

    那要怎么获取上传文件名?strus2
      

  7.   

    struts 2中,你是如何在後台拿到文件對象的?