在開發Struts項目時,我們有時需要獲取項目的根目錄,可以使用下面的方法獲?。?/p>
ActionContext ac = ActionContext.getContext();
ServletContext sc = (ServletContext) ac.get(ServletActionContext.SERVLET_CONTEXT);
String temp = ServletActionContext.getRequest().getRealPath("/");
新聞熱點
疑難解答