Mapping问题之Mapping是什么


1、Mapping 是什么?

web.xml文件中的 < servlet-mapping > 框内信息为请求映射的路径信息

比如说举个简单的例子:


 hello
 /hello

在地址栏输入 localhost:8080/servlet-001/hello 就会访问到 servlet-001 这个文件夹下的我们自己写的class程序(HelloServlet)

如果我现在改成这样


 hello
 /hello/hello

很明显我需要在地址栏输入 localhost:8080/servlet-001/hello/hello 才能访问到 servlet-001 这个文件夹下的我们自己写的class程序(HelloServlet)

相关