我:
/** 
     * 解析模板生成Excel stream
     * @param templateName 模板名称 
     * @param data 数据参数 
     * @throws IOException 
     * @throws TemplateException 
     */  
    public static ByteArrayOutputStream parse(String templateName,Map<String,Object> data) throws IOException, TemplateException {  
        //初始化工作  
        Configuration cfg = new Configuration();  
        //设置默认编码格式为UTF-8  
        cfg.setDefaultEncoding(Constants.DEFAULT_URL_ENCODING);   
        //全局数字格式  
        cfg.setNumberFormat("0.00"); 
        //指定模板路径
org.springframework.core.io.Resource resource =new DefaultResourceLoader().getResource(TEMPLATE_PATH);
//        //设置模板文件位置  
        cfg.setDirectoryForTemplateLoading(resource.getFile());
        cfg.setObjectWrapper(new DefaultObjectWrapper());  
//        //加载模板  
        Template template = cfg.getTemplate(templateName,Constants.DEFAULT_URL_ENCODING);  
        ByteArrayOutputStream outStream = null;        Writer out = null;
        try{  
         outStream = new ByteArrayOutputStream();  
            out = new OutputStreamWriter(outStream,Constants.DEFAULT_URL_ENCODING);  
            template.process(data, out);  
            return outStream;
        }finally{  
            out.close();  
        }     
    }  
  工具类
我:
/**
 * 导出excle统一处理
 * @param resultList 需要导出exlce的数据
 * @param templateName excle模版的名字
 * @param excleName  excel的文件名
 * @throws Exception
 */
protected void processExcel(List<?> resultList,String templateName,String excleName) throws Exception{
Map<String,Object> data = new HashMap<String, Object>();  
String officialDate = request.getParameter("officialDate");
    data.put("resultList", resultList);  
  
    try {  
     ByteArrayOutputStream baos = null;
     baos = TemplateParseUtil.parse(templateName, data);  
     if(StringUtil.isBlank(officialDate)){
     officialDate=Constants.All;
     }else if(officialDate.length()>4){//部分报表的 开始时间只有年份
     officialDate=DateUtil.stringToString(officialDate, PubConsts.DATE_FORMAT,PubConsts.YYYY_MM_DD_LONG_TIME);
     }
        String fileName = excleName+officialDate+Constants.XLS;//导出excel的文件名
        response.setHeader("Content-Disposition", "attachment; filename=" + new String(fileName.getBytes(),"iso-8859-1"));
ServletOutputStream out = response.getOutputStream();
out.write(baos.toByteArray());
out.flush();
out.close();

    } catch (IOException e) {  
        // TODO Auto-generated catch block  
        e.printStackTrace();  
    } catch (TemplateException e) {  
        // TODO Auto-generated catch block  
        e.printStackTrace();  
    }  
}
我:
basecontroller
我:
/** 
 * Excel文件的生成 
 */  
@RequestMapping("/typeExportExcel")
public void exportExcel()throws Exception{
String officialDate=null;
     String signDate=null;
     if(null!=request.getParameter("officialDate")){
     officialDate=request.getParameter("officialDate");
     }else if(null!=request.getParameter("signDate")){
     officialDate="1000-01-01";
     }
    
     if(null!=request.getParameter("signDate")){
     signDate=request.getParameter("signDate");
     }else if(null!=request.getParameter("officialDate")){
     signDate="9999-12-31";    
     }
    
     ServiceTypeVO ddeptVo=new ServiceTypeVO();
        ddeptVo.setSignDate(signDate);
        ddeptVo.setOfficialDate(officialDate);
        List<ServiceTypePO> resultList = ServiceTypeService.getQueryList(ddeptVo);
        String templateName ="ServiceType.ftl";
        String excleName=Constants.SAL_DEP_TYPE;
        this.processExcel(resultList, templateName, excleName);         
}  
controller层
想用spring发送邮件功能 然后添加附件时候 需要附件路径 名字 请问怎么获取