Struts2上传文件空指针异常

刚刚接触Struts2,原先按着书上打是可以上传文件的,但是莫名奇妙又不行了,
还报空指针异常。
这是显示的错误
图片说明

以下Action里的代码:

public class UploadAction extends ActionSupport {
    private String title; //封装上传文件标题的成员变量
    private File upload; //封装上传文件域的成员变量
    private String uploadContentType; / /封装上传文件类型的成员变量
    private String uploadFileName;// 封装上传文件名字的属性
    private String savePath;
    // 接受struts.xml 文件配值的方法
    public void setSavePath(String value) {
        this.savePath = value;
    }

    // 获取上传文件的保存位置
    private String getSavePath() throws Exception {
        return ServletActionContext.getServletContext().getRealPath(savePath);
    }

    public String getTitle() {
        return title;
    }/

    public void setTitle(String title) {
        this.title = title;
    }

    public File getUpload() {
        return upload;
    }

    public void setUpload(File upload) {
        this.upload = upload;
    }

    public String getUploadContentType() {
        return uploadContentType;
    }

    public void setUploadContentType(String uploadContentType) {
        this.uploadContentType = uploadContentType;
    }

    public String getUploadFileName() {
        return uploadFileName;
    }

    public void setUploadFileName(String uploadFileName) {
        this.uploadFileName = uploadFileName;
    }

    @Override
    public String execute() throws Exception {

        FileOutputStream fos=new FileOutputStream(getSavePath()+"\\"+getUploadFileName());
        FileInputStream fis=new FileInputStream(getUpload());
        byte[] buffer= new byte[1024];
        int len=0;
        while((len=fis.read(buffer))>0){
            fos.write(buffer, 0, len);
        }
        return SUCCESS;
    }
}

以下为strtus.xml的代码

 <struts>
   <package name="lee" extends="struts-default" >
     <action name="upload" class="action.UploadAction">
       <param name="savePath">/uploadFiles</param>
      <!-- <param name="allowTypes">image/png,image/bmp,image/gif,image/jpeg</param> -->
       <result> /success.jsp</result>
       <!--  <result name="input">/upload.jsp</result>-->
     </action>

   </package>

在线等!!!!!!谢谢了!

出现空指针的情况无非就那么几种情况,。。。打个断点看看吧。。

运行代码项目的时候用debug模式

添加文件、文件类型、文件名变量的setter和getter方法,就可以了