Servlet的web.xml,配置映射路径(既访问的位置)
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" version="3.1" metadata-complete="true"> <!--注册servlet--> <servlet> <servlet-name>Hello</servlet-name> <servlet-class>top.lostyou.servlet.HelloServlet</servlet-class> </servlet> <!-- servlet的请求路径--> <servlet-mapping> <servlet-name>Hello</servlet-name> <url-pattern>/Hello</url-pattern> </servlet-mapping> </web-app>