自動注入servletContext對象
1.
@Autowired
private ServletContext servletContext;
獲取項目路徑
String webRootPath=servletContext.getRealPath("");
2種
String path = request.getServletContext().getRealPath("");
自動注入servletContext對象
1.
@Autowired
private ServletContext servletContext;
獲取項目路徑
String webRootPath=servletContext.getRealPath("");
2種
String path = request.getServletContext().getRealPath("");