- ·上一篇文章:Page.IsValid属性的用法
- ·下一篇文章:将·JSP文件转译成Servlet的过程
struts2获取项目根目录的方法
:2016-03-05 15:15:51
在开发Struts项目时,我们有时需要获取项目的根目录,可以使用下面的方法获取:
ActionContext ac = ActionContext.getContext();
ServletContext sc = (ServletContext) ac.get(ServletActionContext.SERVLET_CONTEXT);
String temp = ServletActionContext.getRequest().getRealPath("/");
struts2获取项目根目录的方法