struts2 文件上传

前台代码:

 

struts.xml:

 

action:

 

 

注意:

1)文件对象名就是表单文件控件的name

2)文件类型的命名=文件对象名+FileContentType

3)文件名称的命名=文件对象名+FileName

public String getSavePath() {

  return ServletActionContext.getServletContext().getRealPath(savePath);

 }

 

原文地址:https://www.cnblogs.com/syjp/p/10360508.html