SSH2 框架 文件上传不了问题

之前报struts.multipart.saveDir错误,配置过后不报错了,但也上传不了文件了,现在完全蒙圈了
action代码,action配置是最简单配置,这是别人的代码,我拿过来测试的,自己项目跟这个差不多,情况也一样

public class FileUploadAction extends ActionSupport{
private File image;
//获得文件的文件名,格式为:nameFileName,这里格式中的name为jsp页面中的name属性
private String imageFileName;

public String getImageFileName() {
    return imageFileName;
}
public void setImageFileName(String imageFileName) {
    this.imageFileName = imageFileName;
}
public File getImage() {
    return image;
}
public void setImage(File image) {
    this.image = image;
}

public String execute() throws Exception{
    //获得要存放图片的绝对路径
    String realpath = ServletActionContext.getServletContext().getRealPath("/user/usericon");
    System.out.println(realpath);
    //在路径下创建上传的文件
    File savefile = new File(new File(realpath),imageFileName);
    if(image!=null){
        if(!savefile.getParentFile().exists()){
            //如果路径不存在,则创建一个
            savefile.getParentFile().mkdirs();
            //把上传的文件保存在路径中
            FileUtils.copyFile(image, savefile);
            ActionContext.getContext().put("message", "上传成功");
            System.out.println("上传成功");
            return "seccuss";
        }
    }else{
        System.out.println("文件为空");
        return "error";
    }
    return "error";
}
public String getfile(){
    System.out.println(imageFileName);
    return "error";
}

}

jsp代码

  
        文件:  
          
      

断点调试下 看下是哪里的问题,估计是获取不到前台信息是吧,那么应该是前台文件没有传过来,猜你是表单提交,然后没有写enctype="multipart/form-data"

【1】上传图片需要用 post方式,,而且form表单加上设置【enctype="multipart/form-data"】

【2】题主可以在后台打个断点,看看请求是否到达