The difference between the beginning and end of a java web path

Source: Internet
Author: User

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/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.