request.getContextPath()可以获取 /aa

解决方案 »

  1.   

    request.getServerName()+request.getContextPath()
      

  2.   

    request.getContextPath() = http://192.168.0.22:8080/
      

  3.   

    上面老兄说的有些差异,request.getContextPath()不一定等于http://192.168.0.22:8080/。
    在weblogic中是这样的,但是在tomcat 中就不等了。
    request.getContextPath() = http://192.168.0.22:8080/aa/还有一些人说
    request.getContextPath() = “/”。
    其实也是不一定的,根据服务器的不同,意思不一样。建议大家使用前测试一下。