request.getRequestURL() 返回全路径
request.getRequestURI() 返回除去host(域名或ip)部份的路径
request.getContextPath() 返回工程名部份,如果工程映照为/,此处返回则为空
request.getServletPath() 返回除去host和工程名部份的路径
例如:
request.getRequestURL()
http://localhost:8080/jqueryLearn/resources/request.jsp
request.getRequestURI() /jqueryLearn/resources/request.jsp
request.getContextPath()/jqueryLearn
request.getServletPath()/resources/request.jsp
注: resources为WebContext下的目录名
jqueryLearn 为工程名