我DispatcherServlets:Servlet的模式
<servlet>
<servlet-name>users</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>users</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>get</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>get</servlet-name>
<url-pattern>/get/</url-pattern>
</servlet-mapping>
所有請求都委託給第一控制器。我想創建兩個Servlet,
- 有了這樣
localhost:8080/myapp/myrequest
- 要求如
localhost:8080/myapp/get/something
我必須設置什麼模式的要求嗎?
爲什麼你首先有兩個servlet,而不僅僅是一個? –