方式一:
HttpSession session = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(true);
String rootpatch = session.getServletContext().getRealPath("/");
方式二:
public static String getRealPath(String path) 

        return  ((ServletContext) FacesContext.getCurrentInstance()
.getExternalContext().getContext()).getRealPath(path); 
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-29
  • 2022-12-23
  • 2021-06-29
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案