request.getSession().getServletContext().getRealPath(“/updload/video/”) 得到项目的绝对路径
2017-04-14 13:42
706 查看
request.getRealPath不推荐使用request.getRealPath("") 这个方法已经不推荐使用了,那代替它的是什么方法 Deprecated. As of Version 2.1 of the Java Servlet API, use ServletContext.getRealPath(java.lang.String) instead. request.getSession().getServletContext().getRealPath()
得到站点的绝对地址
如request.getSession().getServletContext().getRealPath(File.separator) 得到项目的绝对路径如:
D:\ProgramFiles\apache-tomcat-6.0.33\webapps\wt4\
request.getSession().getServletContext().getRealPath(“/updload/video/”) 得到项目的绝对路径
D:\ProgramFiles\apache-tomcat-6.0.33\webapps\wt4\updload\video\
得到站点的绝对地址
如request.getSession().getServletContext().getRealPath(File.separator) 得到项目的绝对路径如:
D:\ProgramFiles\apache-tomcat-6.0.33\webapps\wt4\
request.getSession().getServletContext().getRealPath(“/updload/video/”) 得到项目的绝对路径
D:\ProgramFiles\apache-tomcat-6.0.33\webapps\wt4\updload\video\
相关文章推荐
- eclipse配置外部tomcat需要注意的问题。(怎样让request.getSession().getServletContext().getRealPath("/")得到正确的路径结果)
- String filePath = request.getSession().getServletContext().getRealPath("/");这句话返回的路径是什么,解释下getRealPath("/")函数中的"/"表示什么意思
- request.getContextPath(),绝对路径,request.getRealPath
- JavaEE 保存文件获取绝对路径getResource("")和servletContext.getRealPath("/")
- request.getContextPath(),绝对路径,request.getRealPath
- request.getContextPath()用el表达式怎么写,绝对路径:request.getRealPath
- 在servlet 中使用 request.getSession().getServletContext().getRealPath("upload/" ); 获取不到 tomcat 服务器目录
- request.getContextPath()用el表达式怎么写,绝对路径:request.getRealPath
- 有关请求路径的总结 request.getContextPath()、request.getServletContext().getRealPath("")、request.getRequestURI
- 如何获得Webapp的根项目路径 即ServletContext.getRealPath() 的输入参数要以"/"开头
- 用getServletContext().getRealPath(FILE_PATH)获取绝对路径为null
- JSP之项目路径问题(${pageContext.request.contextPath},<%=request.getContextPath()%>以及绝对路径获取)
- request.getSession().getServletContext() .getRealPath("/")
- JSP之项目路径问题(${pageContext.request.contextPath},<%=request.getContextPath()%>以及绝对路径获取)
- JSP之项目路径问题(${pageContext.request.contextPath},<%=request.getContextPath()%>以及绝对路径获取)
- weblogic上以War包部署的项目中 request.getRealPath()或者getServletContext.getRealPath()为null的原因及解决方法
- JavaEE 保存文件获取绝对路径getResource("")和servletContext.getRealPath("/")
- request.getSession().getServletContext().getRealPath("/");
- request.getSession().getServletContext().getRealPath("/");
- request.getContextPath()用el表达式怎么写,绝对路径:request.getRealPath