WEB 獲取WebRoot根目錄

Controller:
1.Struts2:
	String path = ServletActionContext.getServletContext().getRealPath(UPLOADDIR);

2.SpringMVC:
	String path1 = request.getSession().getServletContext().getRealPath("/videos/download");

3.Servlet:
	String path = getServletContext().getRealPath("/videos/newvideos");


JSP:
	<%=request.getContextPath()%>
	${pageContext.request.contextPath }
相關文章
相關標籤/搜索