String filePath = request.getSession().getServletContext().getRealPath("/");请问这句话返回的路径是什么,解释下getRealPath("/")函数中的"/"表示什么意思,
来源:学生作业帮助网 编辑:作业帮 时间:2024/06/27 18:59:13
![String filePath = request.getSession().getServletContext().getRealPath(](/uploads/image/z/12809838-30-8.jpg?t=String+filePath+%3D+request.getSession%28%29.getServletContext%28%29.getRealPath%28%22%2F%22%29%3B%E8%AF%B7%E9%97%AE%E8%BF%99%E5%8F%A5%E8%AF%9D%E8%BF%94%E5%9B%9E%E7%9A%84%E8%B7%AF%E5%BE%84%E6%98%AF%E4%BB%80%E4%B9%88%2C%E8%A7%A3%E9%87%8A%E4%B8%8BgetRealPath%28%22%2F%22%29%E5%87%BD%E6%95%B0%E4%B8%AD%E7%9A%84%22%2F%22%E8%A1%A8%E7%A4%BA%E4%BB%80%E4%B9%88%E6%84%8F%E6%80%9D%2C)
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\