以虚拟路径访问。
server.xml相关配置如下:
request.getServletPath()得到访问路径------------------>/index.jsp
request.getContextPath()得到虚拟目录名字------------>/anyName
this.getServletContext().getContextPath() 也是得到虚拟目录名字-------------->/anyName
this.getServletContext().getRealPath("/")得到当前虚拟目录下对应的真实路径------>C:\zzzz\
注:this.getServletContext()就是一个application对象