web获取项目绝对路径

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

你可能感兴趣的:(职场,休闲)