Having two different servlets mapped on the same URL pattern

前端 未结 1 483
旧巷少年郎
旧巷少年郎 2020-12-31 13:22

I encountered a J2EE project written by others. When I come to the web.xml, there are two different servlets mapped on the same URL pattern. I wonder the purpos

相关标签:
1条回答
  • 2020-12-31 14:06

    Only one servlet will get called; there's no mechanism I'm aware of for handling a single request with two servlets (nor am I sure what that would even mean).

    Servlet URL patterns may overlap, but having two with the exact same URL doesn't make sense. I don't recall if the servlet spec explicitly disallows it, however matching stops at the first matching. The matching method is defined in the spec.

    Servlet 2.4 spec PDF See p. 85+

    0 讨论(0)
提交回复
热议问题