struts2上传图片怎样保存webroot目录下img文件, 二不是上传到服务器里面,因为要把项目部署别人的电脑上,求解? 放到哪还不是你的action说了算么 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 public String execute() throws Exception { String realpath=ServletActionContext.getServletContext().getRealPath("/upload"); System.out.println(realpath); if(image!=null){ File savefile =new File(new File(realpath),imageFileName); if(!savefile.getParentFile().exists())savefile.getParentFile().mkdirs(); FileUtils.copyFile(image, savefile); ActionContext.getContext().put("imageFileName", imageFileName); ActionContext.getContext().put("realpath", realpath); } System.out.println(imageFileName); return SUCCESS;}这是我的action 怎嘛修改啊??? 关于RMI的问题?急!!!!!!!!!!!! struts2.1+Hibernate3.3+spring3.0整合添加代理事务出错 求助web开发从数据库取日期问题 Spring+Hibernate中的临时表问题 安装过Jive的请看! 怎样把记录和.properties文件的记录进行比较? 熟悉JFREECHART的进来看看 struts问题,为什么取不到值???(在线等候...) jsp和xml加密签名问题 基于Web的数据挖掘 JBPM4.4与SSH框架整合之后,启动Tomcat6.0之后,一直在查询JBPM4_JOB 空指针问题,求解?
String realpath=ServletActionContext.getServletContext().getRealPath("/upload");
System.out.println(realpath);
if(image!=null){
File savefile =new File(new File(realpath),imageFileName);
if(!savefile.getParentFile().exists())savefile.getParentFile().mkdirs();
FileUtils.copyFile(image, savefile);
ActionContext.getContext().put("imageFileName", imageFileName);
ActionContext.getContext().put("realpath", realpath);
}
System.out.println(imageFileName);
return SUCCESS;
}这是我的action 怎嘛修改啊???