The difference between the beginning and end of a java web path
In general, some may start with the directory, but not from the current directory. 1. Foreground page
The page requests static resources from the server page without specifying <base href = "<% = basePath %>">
Visit the following page
Localhost: 8080/resolvent/index. jsp
Localhost: 8080/resolvent/servlet/dnf
Yes/
The following directory is the domain name + port number (localhost: 8080)
Request the following resources
<Script type = "text/css" src = ''/demo. js"> </script>
The final request sent by the browser is localhost: 8080/demo. js.
No/
<Script type = "text/css" src = ''demo. js "> </script>
Localhost: 8080/resolvent/demo. js current directory localhost: 8080/resolvent/
Localhost: 8080/resolvent/servlet/demo. js current directory localhost: 8080/resolvent/servlet/
2. Background code
Request forwarding and request redirection. The following two URLs are used as examples.
Localhost: 8080/resolvent/servlet/dnf
Localhost: 8080/resolvent/index. jsp
Yes/
The root directory is (localhost: 8080/resolvent)
Request. getRequestDispatcher ("/login. jsp"). forward (request, response );
All will be located
Localhost: 8080/resolvent/login. jsp
No/
Request. getRequestDispatcher ("login. jsp"). forward (request, response );
Localhost: 8080/resolvent/servlet/login. jsp current directory localhost: 8080/resolvent/servlet/
Localhost: 8080/resolvent/login. jsp current directory localhost: 8080/resolvent/