struts2 上传附件 处理
private File picFile;//附件private String picFileFileName; //文件名称 private String picFileContentType; //文件类型public String add() throws Exception{String path = new SimpleDateFormat("yyyyMM").format(new Date())+ "/";String tpath = FileUtil.getTomcatPath()+request.getContextPath()+"/images/";if (picFile != null) { File savefile = new File(new File(tpath+path),picFileFileName); if (!savefile.getParentFile().exists()) savefile.getParentFile().mkdirs(); FileUtil.copyFile(picFile, savefile); } }