virtual path

          When files are uploaded to a remote server using Dreamweaver, the files reside in a folder in the server's local directory tree. For example, on a server running Microsoft IIS, the path to the home page might look like this:
c:\Inetpub\wwwroot\accounts\users\jsmith\index2.htm
This path is often referred to as the file's physical path. However, the URL used to open the file does not use a physical path. It uses the server name or domain name followed by a virtual path.
When programming server-side components, you're likely to get the real path of a file from a path relative to the web root, but the file is actually on a virtual path on the site.

         

<servlet>
  	<servlet-name>MyFirstServlet</servlet-name>
  	<servlet-class>com.itheima.servlet.MyFirstServlet</servlet-class>
  </servlet>
  <servlet-mapping>
  	<servlet-name>MyFirstServlet</servlet-name>
  	<!-- The virtual path of resources when http protocol access starts with /-->
  	<url-pattern>/abc</url-pattern>
  </servlet-mapping>

Access on the browser as shown below:

Domain name: http://localhost:8080/WEB12+virtual path abc (path in <url-pattern>)

Then find <servlet-name> in <servlet-mapping> and then find <servlet-name> in <servlet>

Find the class in <servlet-class>, and then access it.



Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324621175&siteId=291194637