struts2中,在action中获得当前应用的物理文件:
import org.apache.struts2.ServletActionContext;
import com.opensymphony.xwork2.ActionContext;
ServletContext sc = (ServletContext) ActionContext.getContext().get(ServletActionContext.SERVLET_CONTEXT);
String filePath = sc.getRealPath("/");