因为工作中涉及文件操作。需要获取物理路径。
ActionContextac=ActionContext.getContext();
ServletContextsc=(ServletContext)ac.get(ServletActionContext.SERVLET_CONTEXT);
Stringpath=sc.getRealPath("/");
因为工作中涉及文件操作。需要获取物理路径。
ActionContextac=ActionContext.getContext();
ServletContextsc=(ServletContext)ac.get(ServletActionContext.SERVLET_CONTEXT);
Stringpath=sc.getRealPath("/");