标签:sys request x64 maven 输出 ips pat 运行 apache
System.out.println("getContextPath:"+req.getContextPath());
System.out.println("getServletPath:"+req.getServletPath());
System.out.println("getRequestURI:"+req.getRequestURI());
System.out.println("getRequestURL:"+req.getRequestURL());
System.out.println("getRealPath:"+req.getSession().getServletContext().getRealPath("image") );
输出结果为
getContextPath:/maven
getServletPath:/upload.do
getRequestURI:/maven/upload.do
getRequestURL:http://localhost:8080/maven/upload.do
getRealPath:D:\myecllipse\apache-tomcat-7.0.77-windows-x64\apache-tomcat-7.0.77\wtpwebapps\hcwproject\image
最后一个路径其实是工程在那个目录运行路径,不该路径默认会在工作空间
标签:sys request x64 maven 输出 ips pat 运行 apache
原文地址:https://www.cnblogs.com/itzyz/p/12262266.html