requeset.getPath()多种路径获取方式
2018-03-21 16:59
369 查看
假定你的web application 名称为news,你在浏览器中输入请求路径:http://localhost:8080/news/main/list.jsp1.1 System.out.println(request.getContextPath());打印结果:/news1.2 System.out.println(request.getServletPath());打印结果:/main/list.jsp1.3 System.out.println(request.getRequestURI());打印结果:/news/main/list.jsp1.4 System.out.println(request.getRealPath("/"));打印结果:F:\Tomcat 6.0\webapps\news\test
相关文章推荐
- Windows API——SHGetSpecialFolderPath——获取系统特殊路径
- 日常工作问题总结(三十一)windows获取路径的几个函数GetCurrentDirectory,GetModuleFileName,GetFullPathName
- GetRelativePath获取相对路径
- 获取指定的系统路径 SHGetSpecialFolderPath
- 获取文件路径,getCanonicalPath、getAbsolutePath和getPath的区别
- JavaSE8基础 File getAbsolutePath 获取当前默认的工作文件夹路径
- 用getServletContext().getRealPath(FILE_PATH)获取绝对路径为null
- 获取指定的系统路径 SHGetSpecialFolderPath
- java中file类的三种获取路径的方法getPath(),getAbsolutePath(),getCanonicalPath()的比较
- JavaEE 保存文件获取绝对路径getResource("")和servletContext.getRealPath("/")
- 从request获取各种路径总结 request.getRealPath("url"); // 虚拟目录映射为实际目录 request.getRealPat
- java 获取当前文件(项目)路径的多种方式
- 有关Linux下request.getRealPath("/")获取路径的问题
- 获取指定的系统路径 SHGetSpecialFolderPath
- WinAPI: GetPath - 获取路径中的点
- request.getContextPath获取绝对路径
- JSP之项目路径问题(${pageContext.request.contextPath},<%=request.getContextPath()%>以及绝对路径获取)
- 【C#遗补】获取应用程序路径之System.IO.Directory.GetCurrentDirectory和System.Windows.Forms.Application.StartupPath的区别
- jsp获取相对路径网址的方法 request.getContextPath()
- java 获取绝对路径与getRealPath