Web Project Path Issues

Source: Internet
Author: User

Path
Relative path
The first character in a URL is not "/"
Request.getrequestdispatcher ("B");
Relative to the location of the code, it refers to the location of the Java file.

Absolute path
The first character in a URL is not ""
Request.getrequestdispatcher ("/b")
Front desk
/represents the root directory of the server, note: is the root directory of the server
Examples of Use:
HTML page, JSP page, redirect
"ip:port/" Http://localhost:8080/webapps
Background
/represents the root directory of the project note: is the root directory of the project
Examples of Use:
Request.getrequestdispatcher ("B")
Xml
<url-pattern>/a</url-pattern>
http://localhost:8080/helloWorld/a
Webapps/helloworld---Hhtp://ip:port/helloworld

Servlet
The path is determined by the <url-pattern>/basic</url-pattern> in Web. xml
Http://localhost:8888/jd1508/basic
The path does not say that the directory where his class resides
Static resources
Its path is determined by the actual path of the project in which it resides, provided that it is not placed under Web-inf
Webapps/jd1508/html/a.html
Http://localhost:8888/jd1508/html/a.html

Server root directory WebApps--http://ip:port/
The root directory of the project webapps/jd1508--http://ip:port/jd1508

Toahtmlservlet
Http://localhost:8888/jd1508/toAHtml
--->
{Redirect, day7/a.html browser address changed}
Http://localhost:8888/jd1508/day7/a.html
A.html
---> Taservlet
Http://localhost:8888/jd1508/ta

Toahtmlservlet
Http://localhost:8888/jd1508/toAHtml
--->
{Internal jump,/day7/a.html browser address not changed}
Http://localhost:8888/jd1508/toAHtml
A.html
<a href= ". /a.html "></a>
---> Taservlet
Http://localhost:8888/jd1508/ta

Web Project Path Issues

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.