JavaWeb 如何在web.xml中配置多个servlet

时间:2022-02-23 13:23:01

15:34:42

<servlet>
    <description></description>
    <display-name>ListMusicServlet</display-name>
    <servlet-name>ListMusicServlet</servlet-name>
    <servlet-class>com.wlc.ListMusicServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>ListMusicServlet</servlet-name>
    <url-pattern>/ListMusicServlet</url-pattern>
  </servlet-mapping>
  <servlet>
    <description></description>
    <display-name>ListCaffeServlet</display-name>
    <servlet-name>ListCaffeServlet</servlet-name>
    <servlet-class>com.wlc.ListCaffeServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>ListCaffeServlet</servlet-name>
    <url-pattern>/ListCaffeServlet</url-pattern>
  </servlet-mapping>
  <servlet>
    <description></description>
    <display-name>CartServlet</display-name>
    <servlet-name>CartServlet</servlet-name>
    <servlet-class>com.wlc.CartServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>CartServlet</servlet-name>
    <url-pattern>/CartServlet</url-pattern>
  </servlet-mapping>

需要在web.xml 中这样这样配置