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
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+