Struts2获取当前项目的根目录

ActionContext ac = ActionContext.getContext(); 
		ServletContext sc = (ServletContext) ac.get(ServletActionContext.SERVLET_CONTEXT); 
		String path = sc.getRealPath("/");
		System.out.println("new path := " + path);


你可能感兴趣的:(struts,String,Path)