Request.getRequestURL () and other methods to get the path difference

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

Insert picture description hereInsert picture description here

Published 24 original articles · praised 4 · visits 2038

Guess you like

Origin blog.csdn.net/weixin_44226263/article/details/104796650