linux下Servlet中各种Path的值

来源:互联网 发布:畅捷通软件下载 编辑:程序博客网 时间:2024/05/20 09:26

在linux中tomcat下打印项目HttpServletRequest的值,如下:

System.out.println("request.getServletContext().getRealPath :" + request.getServletContext().getRealPath(""));System.out.println("request.getServletContext().getContextPath():" + request.getServletContext().getContextPath());System.out.println("request.getContextPath():" + request.getContextPath());System.out.println("request.getRealPath():" + request.getRealPath(""));

request.getServletContext().getRealPath:
/home/opt/apache-tomcat-8.5.5/webapps/projectname/

request.getServletContext().getContextPath():
/projectname

request.getContextPath():
/projectname

request.getRealPath():
/home/opt/apache-tomcat-8.5.5/webapps/projectname/

0 0
原创粉丝点击