Detailed analysis of servlet addresses and servlet address Analysis

Source: Internet
Author: User

Detailed analysis of servlet addresses and servlet address Analysis

Path

Hypothesis;

Project name: day01

Demo.html

Forwarding

Request. getRequestDispatcherType ("path"). forward (request, response); // path =/demo.html

Redirection

Response. sendRedirect ("path"); // path =/day01/demo.html

Url in html

<Html>

<Head> <title>

<Body> <a href = 'path'> hyperlink </a> </body> // path =/day01/demo.html

</Html>

Submission address in the action of form

<Html>

<Head> <title>

<Body> <form action = "path"> </form> </body> // path =/day01/demo.html

</Html>

Summary:

Who is the target resource used?

1. the tomcat server/Represents the root directory of the current web Project ('root directory '). You can directly write the static resource name.

2. The Browser/Represents webapps, so the project name and static resource name must be added.

Note: the root directory of a web project refers to the project name. However, when the project is deployed on the tomcat server, it copies the project to webapps, the folders and files under webroot are directly copied to the project's underground. The structure of the webroot overwrite directory is as follows:

Project working directory

  

Local file directory (no webroot directory)

  

Load External Resources

See servletcontext and servletconfig.

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.