request请求地址

1、String contextPath = httpServletRequest.getServletContext().getContextPath();

/项目名称

2、String contextPath2 = httpServletRequest.getContextPath();

/项目名称

3、String requestURI = httpServletRequest.getRequestURI();

/项目名称/自定义.jsp

4、StringBuffer requestURL = httpServletRequest.getRequestURL();

http://localhost:8089/项目名称/自定义.jsp

5、String servletPath = httpServletRequest.getServletPath();

/自定义.jsp

原文地址:https://www.cnblogs.com/zhaoyan001/p/6297346.html