Mapping映射问题

Mapping问题

1.一个Servlet可以指定一个映射路径

<!--默认端口号:http://localhost:8080/hello  -->
<servlet-mapping>
  <servlet-name>hellowSer</servlet-name>
  <url-pattern>/yang</url-pattern>
</servlet-mapping>
http://localhost:8080/hello/yang

2.一个Servlet可以指定多个映射路径

<servlet-mapping>
  <servlet-name>hellowSer</servlet-name>
  <url-pattern>/yang</url-pattern>
</servlet-mapping>

<servlet-mapping>
  <servlet-name>hellowSer</servlet-name>
  <url-pattern>/yang1</url-pattern>
</servlet-mapping>
<servlet-mapping>
  <servlet-name>hellowSer</servlet-name>
  <url-pattern>/yang2</url-pattern>
</servlet-mapping>
<servlet-mapping>
  <servlet-name>hellowSer</servlet-name>
  <url-pattern>/yang3</url-pattern>
</servlet-mapping>

3.一个Servlet可以指定通用映射路径

<servlet-mapping>
  <servlet-name>hellowSer</servlet-name>
  <url-pattern>/hello/*</url-pattern>
</servlet-mapping>

4.默认请求路径

<servlet-mapping>
<servlet-name>hellowSer</servlet-name>
<url-pattern>/hello/*</url-pattern>
</servlet-mapping>
http://localhost:8080/hello/

5.指定一些后缀或者前缀......

<servlet-mapping>
<servlet-name>hellowSer</servlet-name>
<url-pattern>*.yang</url-pattern>
</servlet-mapping>
http://localhost:8080/hello/cat.yang

 

上一篇:IEEE年度大奖揭幕!华人科学家,Yang-Kieffer算法之父杨恩辉斩获Eric E.Summer奖


下一篇:【满天星】02 告别惰性