在開發(fā)Struts項(xiàng)目時,我們有時需要獲取項(xiàng)目的根目錄,可以使用下面的方法獲取:
ActionContext ac = ActionContext.getContext();
ServletContext sc = (ServletContext) ac.get(ServletActionContext.SERVLET_CONTEXT);
String temp = ServletActionContext.getRequest().getRealPath("/");
新聞熱點(diǎn)
疑難解答
圖片精選