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 }
相关文章
相关标签/搜索