web applications path jump problem - a relative path, an absolute path

web application path turned the problem - relative path, an absolute path (/ represents the root directory of the server (ip + port) or root directory of the project?)

Path into the absolute and relative paths, a relative path is the path to the target with respect to the current file, web page design in the use of this method to represent the target path .

Absolute path is the full URL, assuming the project path in the following figure is http: // localhost: 8080 / vi_tmall. Index.jsp absolute address is: http: // localhost: 8080 / vi_tmall / index.jsp.

 

In the process of writing code, the absolute path is our path "/" at the beginning, then the "/" What represents the server's root directory or the root directory of the project it?

Hyperlinks 1.jsp page in the href attribute and the form of the action attribute / represents the root directory of the server method if you want to get the root directory of the project can be used request.getContextPath () Gets.

2. Request Redirection / indicates the root directory of the server.

3. The configuration file path / represents the root directory of the project.

4. The request is forwarded in / indicates the root directory of the project.

 

in conclusion:

In the server-side processing (configuration files, request forwarding) / representative is the root directory of the project. In the client-side processing (jsp page hyperlinks and form, the request is redirected) / representative is the root directory of the server

Standing need to see what angle to consider the issue.

Another point to note is that, if the "?" At the beginning of the path, expressed in the href attribute access path to the current page, of course, "?" Followed carrying parameters.

 

Guess you like

Origin www.cnblogs.com/blogforvi/p/11617099.html