Relative Path and absolute path, absolute path
1. The relative paths are based on the current resource, but the benchmark changes during forwarding, so it is not reliable.
2. absolute path, starting.
(1) When parsed by a browser, "/" represents the host address of the current server, http: // localhost: 8080/, mostly used for redirection.
(2) when parsing by the server, "/" indicates the current Web application http: // localhost: 8080/webapp/, which is equivalent to the WebContent directory and mostly used for internal server forwarding, there is web. in xml, the url address in URL-pattern.
3. base Tag: serves as the reference for the relative path of the URL address in the entire HTML document.
Protocol: request. getProtocol ()
Server address: request. getServerName ()
Port: request. getServerPort ()
Web application virtual path: request. getContextPath ()
Dynamic Base Tag: <base href = "http: // $ {pageContext. request. serverName }:$ {pageContext. request. serverPort }$ {pageContext. request. contextPath}/"/>
Note:
(1) Format: <base href = "http: // host address/Web application virtual path/"/>
(2) write in the head tag-before all URLs
(3) the benchmark specified by the base tag is only valid for the relative path.
(4) The URL address in the base tag should end "/"