struts2

struts2中获取项目所在的物理路径:

ActionContext ac = ActionContext.getContext();  
            ServletContext sc = (ServletContext) ac.get(ServletActionContext.SERVLET_CONTEXT);  

String path = sc.getRealPath("/");

磁盘.../项目名/WebRoot/

原文地址:https://www.cnblogs.com/xy-1988xcl/p/5283882.html