得到项目的绝对路径
2011-04-16 23:18
302 查看
今天开发项目中发现:
request.getRealPath(arg0);
报警告:
The method getRealPath(String) from the type ServletRequest is deprecated
request.getRealPath("")
这个方法已经不推荐使用了,那代替它的是什么方法呢?
Deprecated. As of Version 2.1 of the Java Servlet API, use ServletContext.getRealPath(java.lang.String) instead.
[b]request.getSession().getServletContext().getRealPath()
[/b]
[b]得到站点的绝对地址 如:
[/b]
D:/apache-tomcat-6.0.29/webapps/csts_12/
request.getContextPath()则显示: /csts_12
request.getRealPath(arg0);
报警告:
The method getRealPath(String) from the type ServletRequest is deprecated
request.getRealPath("")
这个方法已经不推荐使用了,那代替它的是什么方法呢?
Deprecated. As of Version 2.1 of the Java Servlet API, use ServletContext.getRealPath(java.lang.String) instead.
[b]request.getSession().getServletContext().getRealPath()
[/b]
[b]得到站点的绝对地址 如:
[/b]
D:/apache-tomcat-6.0.29/webapps/csts_12/
request.getContextPath()则显示: /csts_12
相关文章推荐
- 得到项目下文件的绝对路径
- 得到项目实际的绝对路径
- request.getSession().getServletContext().getRealPath(“/updload/video/”) 得到项目的绝对路径
- 获取web项目的绝对路径的方法总结
- Java获得项目绝对路径方法总结
- Linux内核中用d_path得到绝对路径名
- 从requset取出ServletContext,从而得到站点绝对路径
- javaweb项目绝对和相对路径问题
- Java得到上下文的绝对路径
- windows linux 下,获取java项目绝对路径的方法
- jsp 获取项目绝对路径
- jsp 获取项目绝对路径
- JavaScript中获取当前项目的绝对路径
- JAVA 得到上下文绝对路径
- java获得项目绝对路径
- ASP.NET 中得到网站绝对路径的几种方法
- Java获取项目绝对路径
- servlet中获得项目绝对路径
- web项目中相对路径与绝对路径
- springboot 获取项目绝对路径