HttpServletRequest的getContextPath()、getServletPath()和getRequestURI()的区别
这里以例子作为说明。
假设项目名称是pro,登录url是localhost:8080/pro/user/login.action,注销url是localhost:8080/pro/user/logout
登录
- getContextPath():/pro
- getServletPath():/user/login.action
- getRequestURI():/pro/user/login.action
注销:
- getContextPath():/pro
- getServletPath():/user/logout
- getRequestURI():/pro/user/logout