String filePath = request.getSession().getServletContext().getRealPath("/");请问这句话返回的路径是什么,解释下getRealPath("/")函数中的"/"表示什么意思,

来源:学生作业帮助网 编辑:作业帮 时间:2024/07/12 18:02:58
String filePath = request.getSession().getServletContext().getRealPath(
xR;OP+IYLƸ41Xk{Ǫ("E>X:AA俐2X⠋1qɹ9`xКgʣhhc>P7%-Ay9our8sG]BɧH)ư:e06HY 8ݵOVњTmS[/1¿0p=䴉3Wj@0q

String filePath = request.getSession().getServletContext().getRealPath("/");请问这句话返回的路径是什么,解释下getRealPath("/")函数中的"/"表示什么意思,
String filePath = request.getSession().getServletContext().getRealPath("/");
请问这句话返回的路径是什么,解释下getRealPath("/")函数中的"/"表示什么意思,

String filePath = request.getSession().getServletContext().getRealPath("/");请问这句话返回的路径是什么,解释下getRealPath("/")函数中的"/"表示什么意思,
request.getSession().getServletContext() 获取的是Servlet容器对象,相当于tomcat容器了.getRealPath("/") 获取实际路径,“/”指代项目根目录,所以代码返回的是项目在容器中的实际发布运行的根路径如:I:\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\UMPWeb_20131230\