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

 

Mapping映射问题

上一篇:数据库统计查询优化


下一篇:C#中使用AutoMapper