Struts2获取项目物理路径

因为工作中涉及文件操作。需要获取物理路径。

ActionContext ac = ActionContext.getContext();   
ServletContext sc = (ServletContext) ac.get(ServletActionContext.SERVLET_CONTEXT);   
String path = sc.getRealPath("/");  

你可能感兴趣的:(struts,struts,Path,Path,Path,物理路径)