request.getRequestURL () returns the full path
request.getRequestURI () returns the path except the host (domain name or ip)
request.getContextPath () returns the project name part, if the project mapping is /, it is empty
here.request.getServletPath ( ) Return the path except the host and the project name.
Here is the running result
request.getRequestURL (): http: // localhost: 8080 / bzbs / system / login.jsp
request.getRequestURI (): / bzbs / system / login.jsp
request.getContextPath (): / bzbs
request.getServletPath (): / system / login.jsp
Request.getRequestURL () and other methods to get the path difference
Guess you like
Origin blog.csdn.net/weixin_44226263/article/details/104796650
Recommended
Ranking