java中getRealPath("/")和getContextPath()的区别
来源:互联网 发布:java开发环境包括 编辑:程序博客网 时间:2024/06/05 06:48
一.以下是在servlet中测试的。
二.运行结果如下(其中myfile文件夹是不存在的)。
三.总结。
1.getRealPath("/")方法返回的是项目在服务器的绝对路径,而getRealPath("WEB-INF/myfile")返回的是包含一个给定虚拟路径的绝对路径,其中/myfile是虚拟的。
2.getContextPath()方法返回的是项目相对路径,并不会返回其绝对的路径,就是说并不知道项目在哪个位置。
阅读全文
1 0
- java中getRealPath("/")和getContextPath()的区别
- getRealPath()和getContextPath()的区别
- getRealPath()和getContextPath()的区别
- getContextPath和getRealPath的区别
- getContextPath和getRealPath的区别
- getRealPath()和getContextPath()的区别
- getRealPath()和getContextPath()的区别
- request.getContextPath()和request.getRealPath()的区别
- Request中getContextPath、getServletPath、getRequestURI、request.getRealPath的区别
- Request中getContextPath、getServletPath、getRequestURI、request.getRealPath的区别
- Request中getContextPath、getServletPath、getRequestURI、request.getRealPath的区别
- Request中getContextPath、getServletPath、getRequestURI、request.getRealPath的区别
- Request中getContextPath、getServletPath、getRequestURI、getRequestURL、getRealPath的区别
- Request中getContextPath、getServletPath、getRequestURI、request.getRealPath的区别
- Request中getContextPath、getServletPath、getRequestURI、request.getRealPath的区别
- Request中getContextPath、getServletPath、getRequestURI、request.getRealPath的区别
- Request中getContextPath、getServletPath、getRequestURI、request.getRealPath的区别
- Request中getContextPath、getServletPath、getRequestURI、request.getRealPath的区别
- Java内部类详解
- CSDN上的第一篇博客
- 数据挖掘2基础概念
- 学会使用 Gson @SerializedName
- Android6.0运行时权限解析,RxPermissions的使用
- java中getRealPath("/")和getContextPath()的区别
- HDU5316-Magician
- leetcode 168. Excel Sheet Column Title
- Spring下面的classpath 和 classpath* 区别的简单讲解
- C语言中两个整数转换成float型的小数
- Table
- [html&css]Pass Through
- Screen kill 的两种办法
- xml配置多类参数解析